Skip to content

Commit

Permalink
fix proxy headers
Browse files Browse the repository at this point in the history
  • Loading branch information
krokicki committed Aug 2, 2024
1 parent 79a81fb commit c52f29f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 4 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 2 additions & 2 deletions jproxy/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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})
Expand Down

0 comments on commit c52f29f

Please sign in to comment.