Skip to content

[BUG] Incorrect host being passed to application when this container is behind a reverse proxy #31

@KuroSetsuna29

Description

@KuroSetsuna29

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using a reverse proxy, such as nginx, to proxy pass to this container the application is loading resources and redirecting with incorrect host.

For example, my reverse proxy is running on https://speedtest.mydomain.com:1443/. Then when going to https://speedtest.mydomain.com:1443/, the application will redirect to https://speedtest.mydomain.com/admin/login (note missing port).

Expected Behavior

Going to https://speedtest.mydomain.com:1443/ should correctly redirect to https://speedtest.mydomain.com:1443/admin/login.

Steps To Reproduce

  1. Setup speedtest-tracker container using defaults
  2. Setup nginx reverse proxy
  3. Go to reverse proxy domain
  4. See incorrect redirect

Environment

- OS: Unraid 6.12.13
- How docker service was installed: Unraid community application
- Reverse proxy container: swag
- Nginx proxy header config:

proxy_set_header Connection $connection_upgrade;
proxy_set_header Early-Data $ssl_early_data;
proxy_set_header Host $http_host;
proxy_set_header Proxy "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Method $request_method;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Server $http_host;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header X-Original-Method $request_method;
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
proxy_set_header X-Real-IP $remote_addr;

CPU architecture

x86-64

Docker creation

docker run
  -d
  --name='speedtest-tracker'
  --net='proxynet'
  --cpuset-cpus='0,1,12,13'
  --pids-limit 2048
  -e TZ="America/New_York"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="KUROPOP"
  -e HOST_CONTAINERNAME="speedtest-tracker"
  -e 'APP_KEY'='*****************'
  -e 'DB_CONNECTION'='sqlite'
  -e 'SPEEDTEST_SCHEDULE'='0 * * * *'
  -e 'SPEEDTEST_SERVERS'='64882,17568,46811'
  -e 'DB_HOST'=''
  -e 'DB_PORT'=''
  -e 'DB_DATABASE'=''
  -e 'DB_USERNAME'=''
  -e 'DB_PASSWORD'=''
  -e 'DISPLAY_TIMEZONE'='America/Toronto'
  -e 'PRUNE_RESULTS_OLDER_THAN'='0'
  -e 'PUID'='99'
  -e 'PGID'='100'
  -e 'UMASK'='000'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:80]'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/speedtest-tracker-logo.png'
  -p '8001:80/tcp'
  -v '/mnt/user/appdata/speedtest-tracker':'/config':'rw' 'lscr.io/linuxserver/speedtest-tracker'

Container logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions