From c52f29f0fb8888d91cc245e22c8ff05c6fa6e09f Mon Sep 17 00:00:00 2001 From: Konrad Rokicki Date: Fri, 2 Aug 2024 08:39:43 -0400 Subject: [PATCH] fix proxy headers --- docker/Dockerfile | 2 +- docker/docker-compose.yml | 4 ++++ jproxy/serve.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0c8c26a..21c3149 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,5 +12,5 @@ WORKDIR /app/jproxy RUN pip install --no-cache-dir --upgrade -r requirements.txt -CMD uvicorn jproxy.serve:app --host ${HOST} --port ${PORT} --workers ${NUM_WORKERS} --access-log +CMD uvicorn jproxy.serve:app --host ${HOST} --port ${PORT} --workers ${NUM_WORKERS} --access-log --forwarded-allow-ips='*' --proxy-headers diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index cb4f3b8..d66791a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -16,9 +16,13 @@ services: jproxy: image: ghcr.io/janeliascicomp/jproxy:0.2.0 + container_name: jproxy restart: unless-stopped ports: - 8000 volumes: - ${CONFIG_FILE}:/app/jproxy/config.yaml - ${VAR_DIR}:/app/jproxy/var + environment: + NUM_WORKERS: 8 + diff --git a/jproxy/serve.py b/jproxy/serve.py index 093201a..dcbc126 100644 --- a/jproxy/serve.py +++ b/jproxy/serve.py @@ -162,7 +162,7 @@ async def browse_bucket(request: Request, target_prefix = '/'+target_name parent_prefix = dir_path(os.path.dirname(prefix.rstrip('/'))) - + return templates.TemplateResponse("browse.html", { "request": request, "bucket_name": bucket_name, @@ -202,7 +202,7 @@ async def target_dispatcher(request: Request, target_name, target_path, is_virtual = get_target(request, path) - if not target_name: + if not target_name or (is_virtual and target_name=='www'): # Return target index bucket_list = { target: f"/{target}/" for target in app.settings.get_targets()} return templates.TemplateResponse("index.html", {"request": request, "links": bucket_list})