Uh oh!
There was an error while loading. Please reload this page.
Add two parameters when Nextcloud is behind a proxy - #527
Conversation
I tried the same thing 2 days ago: you have to run the update.sh script before the commit, then the script will run and test the other images. |
naramski
commented
Oct 27, 2018
Thanks @marceljd it worked :) |
J0WI
commented
Oct 30, 2018
You can also just set some headers, e.g. in nginx: 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; |
J0WI
commented
Dec 5, 2018
@naramski does #527 (comment) work for you? |
naramski
commented
Dec 6, 2018
@J0WI well I don't use Nginx and I prefer to have a standalone configuration for the nextcloud container itself. |
naramski
commented
Dec 6, 2018
So I guess it work, but it doesn't solve my problem. I still think that adding the new parameters doesn't hurt. |
J0WI
commented
Dec 12, 2018
@naramski NC 12 is no longer supported, but NC 15 have been added. Could you rebase your changes? |
naramski
commented
Dec 14, 2018
@J0WI I tried to rebase, but it seems that I have messed something :(. |
J0WI
commented
Dec 14, 2018
Would you like to open a new, clean PR? |
tilosp
commented
Dec 14, 2018
J0WI
commented
Dec 14, 2018
I haven't verified this so far. It would be great to get some feedback from @jkaberg or @funkypenguin. |
pgera
commented
Jan 23, 2019
I had to manually add 'overwriteprotocol' => 'https' for a different issue (nextcloud/server#6767). |
I have investigated these issues and to solve these proxy related problems on a new standard Apache installation this should be added. I have tried this with my Traefik proxy, can anyone test this on Nginx? First: in entrypoint.sh (this will resolve the .well-known errors). Edit: add conditional PROXY_IP, not to be used in other situations: Second: add a new file proxy.config.php in the .config (no HTTPS error in Password app and get the real IP adresses instead of the proxy IP). This is faster and easier than with OCC commands. There will be one extra environment variable: PROXY_IP with the ip address of the proxy. |
marceljd
commented
Feb 4, 2019
Some more tests and some more conclusions: Apache running on 443 / SSL I will make a seperate PR for this. Proxy IP
There is another enviroment variable that could tell NC what headers to expect, perhaps this is needed for Nginx or HAproxy. Traefik works without this setting.
I will make a seperate PR for this too. With both solutions the Apache versions should work out-of-the-box. I do think this needs some testing on different setups to be sure it works on all proxies and nothing breaks on existing installations. |
marceljd
commented
Feb 9, 2019
See #644 for the SSL on Apache PR. I will create the trusted proxy PR next week, with both of them in place the SSL and proxy related errors are gone. |
I know that this PR is focused on a solution at application-level, but in case it's useful to anyone using NGinx we just implemented a fix for this issue. In our fix, NGinx switches to relying on a new variable that is based on the Here's the relevant commit: In our case, the proxy is the NGinx ingress controller for Kubernetes. |
bencomp
left a comment
There was a problem hiding this comment.
I don't know if this is the best solution direction, but the Dockerfiles contain git conflicts which should not be accepted.
| VOLUME /var/www/html | ||
| <<<<<<< HEAD:15.0/fpm/Dockerfile |
| } > /etc/apache2/conf-available/remoteip.conf;\ | ||
| a2enconf remoteip | ||
| <<<<<<< HEAD:15.0/apache/Dockerfile |
| VOLUME /var/www/html | ||
| <<<<<<< HEAD:15.0/fpm-alpine/Dockerfile |
Following-up on my earlier comment, in my project, we now also have a solution for Apache-based Nextcloud that does not require environment variables to explicitly override the protocol and host. Here's the Apache version: |
J0WI
commented
Nov 6, 2019
I'll close this in favor of #819 |
Added support for params overwriteprotocol and overwritehost when Nextcloud is behind a proxy and fails to detect hostname and protocol.
(see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/reverse_proxy_configuration.html)