Skip to content

Breaks behind Nginx reverse proxy #109

@BalducciFrancesco

Description

@BalducciFrancesco

I’m trying to run the app behind Nginx under a subpath (/ladder/) instead of at the domain root or on a dedicated port.

Direct access works fine, but access through the reverse proxy subpath does not behave correctly.

What works

Using:

ladder:
  container_name: ladder
  image: ghcr.io/everywall/ladder:latest
  restart: unless-stopped
  build: .
  ports:
    - "8080:8080"
  environment:
    - PORT=8080
    - LOG_URLS=true
    - RULESET=https://raw.githubusercontent.com/everywall/ladder-rules/main/ruleset.yaml

Then visiting:

http://localhost:8080

loads the startup page UI correctly and the app works normally.

What does not work

When I put the app behind Nginx at:

http://localhost/ladder/

the homepage does not load correctly, even though some nested paths do work. For example: http://localhost/ladder/b works while http://localhost/ladder and http://localhost/ladder/ do not behave like the direct-root homepage.

The proxy configuration is

events {}

http {
    server {
        listen 80 default_server;

        location / {
            root /usr/share/nginx/html;
            index index.html;
            try_files $uri $uri/ /index.html;
        }

        location = /ladder {
            return 301 /ladder/;
        }

        location /ladder/ {
            proxy_pass http://ladder:8080/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }
}

The problem seems to be specifically that the app’s homepage are not preserving the /ladder/ prefix and instead appear to assume the app is hosted at /.

Do you guys have a similar issue?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions