X Tutup
The Wayback Machine - https://web.archive.org/web/20201020153754/https://github.com/nextcloud/docker/issues/1230
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect loop behind nginx reverse proxy #1230

Open
DoctorDrunk opened this issue Aug 29, 2020 · 0 comments
Open

Redirect loop behind nginx reverse proxy #1230

DoctorDrunk opened this issue Aug 29, 2020 · 0 comments

Comments

@DoctorDrunk
Copy link

@DoctorDrunk DoctorDrunk commented Aug 29, 2020

I want to run nextcloud on a path behind an nginx reverse proxy. The nginx reverse proxy is already configured and works fine for other services. This is my nextcloud specific location:

        location /nextcloud-demo {
                client_max_body_size 10G;
                proxy_request_buffering off;

                # HTTP 1.1 support
                proxy_http_version 1.1;
                proxy_buffering off;
                proxy_set_header Host $http_host;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $http_upgrade;
                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 $http_x_forwarded_proto;
                proxy_set_header X-Forwarded-Ssl $scheme;
                proxy_set_header X-Forwarded-Port $http_x_forwarded_port;

                # Mitigate httpoxy attack (see README for details)
                proxy_set_header Proxy "";

                proxy_pass http://127.0.0.1:8082;
        }

And this is how i start the nextcloud container:

pi@piserver01:~/nextcloud-demo $ docker run -d --restart always --name nextcloud-demo -p 8082:80 -e NEXTCLOUD_TRUSTED_DOMAINS=example.com -e OVERWRITEWEBROOT=/nextcloud-demo -e NEXTCLOUD_ADMIN_USER=nextcloud-demo-admin -e NEXTCLOUD_ADMIN_PASSWORD=xxx -e SQLITE_DATABASE=db nextcloud:19-apache
3d753b5252b8bc51a29608bd9a63cd10374a94d9aa61bcbca5f588fe3671689b
pi@piserver01:~/nextcloud-demo $ docker logs -f nextcloud-demo
Initializing nextcloud 19.0.2.2 ...
Initializing finished
New nextcloud instance
Installing with SQLite database
starting nextcloud installation
Nextcloud was successfully installed
setting trusted domains…
System config value trusted_domains => 1 set to string example.com
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Sat Aug 29 19:41:50.649446 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.9 configured -- resuming normal operations
[Sat Aug 29 19:41:50.649655 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.17.0.1 - - [29/Aug/2020:19:42:39 +0000] "GET /nextcloud-demo HTTP/1.1" 302 417 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0"
172.17.0.1 - - [29/Aug/2020:19:42:39 +0000] "GET /nextcloud-demo/ HTTP/1.1" 302 1014 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0"
172.17.0.1 - - [29/Aug/2020:19:42:41 +0000] "GET /nextcloud-demo/login HTTP/1.1" 302 909 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0"
172.17.0.1 - - [29/Aug/2020:19:42:41 +0000] "GET /nextcloud-demo/login HTTP/1.1" 302 909 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0"
172.17.0.1 - - [29/Aug/2020:19:42:41 +0000] "GET /nextcloud-demo/login HTTP/1.1" 302 909 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0"
172.17.0.1 - - [29/Aug/2020:19:42:41 +0000] "GET /nextcloud-demo/login HTTP/1.1" 302 909 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0"
...

This setup results in a redirect loop (HTTP 301 and 302) when opening https://example.com/nextcloud-demo.

Do you see any problems with my configuration? I'm not entirely sure how the other OVERWRITE* env vars come into play here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup