nextcloud / nextcloud/docker

Backend Nginx Configuration Issue with Port/Protocol Loss in Redirects

Open
#2,493 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs info
Dominant language
Shell
Stars
7.4k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

The frontend uses Nginx as a reverse proxy with HTTPS enabled, but it utilizes a non-standard web port (e.g., port 8443). After the frontend Nginx reverse proxy, the backend Nginx uses an HTTP connection on port 80. As a result, redirects from the backend lose the original port and protocol.
It is recommended to add absolute_redirect off; to the configuration file at .examples/docker-compose/with-nginx-proxy/postgres/fpm/web/nginx.conf.

This Nginx location configuration for reverse proxy:
location / {
proxy_pass http://127.0.0.1:80$request_uri;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    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-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header Early-Data $ssl_early_data;

    # Websocket
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open .examples/docker-compose/with-nginx-proxy/postgres/fpm/web/nginx.conf and review the backend Nginx configuration in the described HTTPS, non-standard-port setup. Confirm that redirects retain the original protocol and port when the configuration is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, nginx
Domain
devops, infrastructure
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.