Uh oh!
There was an error while loading. Please reload this page.
Added support for proxy configuration using environment variables - #819
Added support for proxy configuration using environment variables#819clickkiddie wants to merge 6 commits into
Conversation
icasdri
commented
Jul 29, 2019
Is |
clickkiddie
commented
Jul 29, 2019
My setup runs with NEXTCLOUD_TRUSTED_DOMAINS, NEXTCLOUD_OVERWRITEPROTOCOL and NEXTCLOUD_OVERWRITEWEBROOT and I can access it using webfrontend, windows desktoop app and andoid app without issues. I don't think |
lukasmrtvy
commented
Aug 3, 2019
Fixes #792 |
You should also consider to implement support for trusted_proxies Without this, You will get a message from nextcloud: |
clickkiddie
commented
Aug 6, 2019
|
clickkiddie
commented
Aug 6, 2019
you are correct. It is missing. I mixed it up with 'trusted_domains'. 'trusted_proxies' should be set for a sane configuration. I'll add it when I have time to test it |
following tests have been performed (updated):
Can somebody explain 6? is that intended behavior? I hope the check is stricter for other header fields. arm64-apache image for testing will be available on Dockhub ( |
@clickkiddie Thanks for making this. I can't wait to use it! Will you rebase/merge from master so this PR is mergeable without write conflicts? |
clickkiddie
commented
Oct 5, 2019
I'll have a look on that during the coming week |
2877ed3 to
72d9eebCompareclickkiddie
commented
Oct 10, 2019
sorry, I recently messed things up during merge. Now it should be in sync again. |
@clickkiddie way to go! Thank you. @J0WI@tilosp y'all have been merging PRs recently. Will you consider merging this or providing feedback? It would really help with using the docker container behind reverse proxies, which I think is pretty common. Thank you :) <3 |
kesselb
commented
Oct 12, 2019
Thanks 👍
I don't think so. You should see the ip of the reverse proxy in this case.
It's good to set it but not required if overwriteprotocol and overwritehost are present. Nextcloud uses the value to generate absolute urls from cli (e.g cron, background job). https://github.com/nextcloud/server/blob/b8fcf6e9b3d492d19bbbdcd144428fef9bbf2324/lib/private/URLGenerator.php#L242-L250
Could you consider to set a default value? I prepared a pull request for it #891 but with a different approach. This one (setting the values on container start) is better. Nginx and Traefik set X-Forwarded-Host and X-Forwarded-Protocol by default. If the request is coming from a trusted proxy overwriteprotocol and overwritehost are superfluous. Not sure if overwrite.cli.url is required then 🤔 (becaue the fallback to overwrite* is missing).
Could you try to cleanup the git history a bit? You can use rebase for it. |
I don't think a default should be set. It might introduce security issues when used without reverse proxy.
I am not able to reproduce this one anymore. Maybe I did something wrong during my tests. Code looks good on first glance, despite scenarios where multiple forwarded-for-headers are defined in config.
done |
kesselb
commented
Oct 12, 2019
With private IPv4 addresses? |
clickkiddie
commented
Oct 13, 2019
Sure. Many larger networks in Universities and Companies have their whole infrastructure - including workstations and wifi dhcp range- in these ranges. Having e.g. 10.x.x.x trusted per default would allow a huge number of clients to spoof being a proxy. |
kesselb
commented
Oct 13, 2019
Convinced ;) |
clickkiddie
commented
Nov 23, 2019
did it. sorry for latency, i'm quite busy currently. can somebody comment / verify the latest test findings from @kesselb ? Which configs work, which not? Do we need to improve the config script or is a doc update sufficient? Currently I have no test system available to work on it. |
JonasBVS
commented
Dec 11, 2019
@clickkiddie i can try verifying or commenting, but is there a procedure for this? which image should i use for testing? besides the travis-ci builds seems to fail at this point!? |
mschoettle
commented
Jan 8, 2020
I have exactly this problem (fpm-alpine, nginx & traefik). How can this PR be tested? |
J0WI
commented
Jan 9, 2020
|
Thanks! Setting these environment variables on a new instance causes the following problem: Without the environment variables (to install it first) I first get "Access through untrusted domain" error when accessing the web interface. For some reason right now even if I add the domain manually in Edit: With the current |
mschoettle
commented
Jan 17, 2020
Setting There should probably be a check before setting the configs based on the environment variables to ensure Nextcloud is installed. However, at the end of the script |
kesselb
commented
Jan 17, 2020
Not messing around with occ ;) I was thinking about putting all those reverse proxy configurations into a separate config file similar to https://github.com/nextcloud/docker/blob/master/.config/smtp.config.php. That's probably less performant but much easier. And works better with the weird way nextcloud handles configuration. But time ... 😞 |
mschoettle
commented
Jan 24, 2020
I meant to just "parse" the output of the |
Login using the nextcloud android app stalled at "grant access" with new login method on Docker installation. I could not pass the step of "grant access" on any device using the Android app. It stayed there forever. Thanks to @rullzer in nextcloud/android#4786 (comment) i understood, that an additional Nextcloud config value overwriteprotocol='http', is necessary in `config.php`. Unfortunately currently it is not possible in the docker template to set this automatically. So for now users need to execute sudo docker-compose exec --user www-data app php occ config:system:set overwriteprotocol --value="https" once to fix this issue. Documented in README.adoc Closesnextcloud/android#4786 Blockey by nextcloud/docker#819 NEXTCLOUD_OVERWRITEPROTOCOL=https
What's the state of this PR? Due to Nextcloud not honoring the |
kesselb
commented
Feb 18, 2020
You can set most configuration variables via ENV by prefixing |
schildbach
commented
Feb 18, 2020
|
ghostkernel-core
commented
Mar 29, 2020
Can anyone please tell me the ENV variables to required to set for the official Nextcloud:latest image so that my config.php have these two settings from the fresh install (initial run) 'overwriteprotocol' => 'https', |
J0WI
commented
Mar 29, 2020
As you can see this PR is not yet merged, so there are currently no ENVs for these settings. You can mount additional config files in the config folders. |
thannaske
commented
Apr 3, 2020
Is there any plan to complete this (imho very important PR)? Without those environment variables you are not able to properly deploy this image in a high-scale k8s-environment. |
ghostkernel-core
commented
Apr 4, 2020
I don't see any movements for the time being. But on the other hand I developed a custom php to add any variables required just pass through the ENV file of the stack. Knock me stating your required variables, if you need one. |
J0WI
commented
Apr 4, 2020
Recent progress have been made in #1048. |
J0WI
commented
Jun 5, 2020
Fixed in #1048. |
Kr4cker
commented
Jan 16, 2021
Just a small hint for the future people coming to this thread. |
yassinwallace
commented
Apr 21, 2021
@Kr4cker Thank you for your input. It helped me. |
Kr4cker
commented
Apr 23, 2021
@yassinwallace yes you are right. I checked the Nextcloud documentation. |
…xies in config.php Various online articles refer to this variable as `TRUSTED_PROXIES`. However, this PR (nextcloud/docker#819) refers to it as `NEXTCLOUD_TRUSTED_PROXIES`. In the end, it appears that neither is true anymore. The entrypoint for Nextcloud v25 does not contain any reference to `NEXTCLOUD_TRUSTED_PROXIES` anymore. It seems like it had gotten removed at some point.
Added environment variables NEXTCLOUD_OVERWRITEPROTOCOL, NEXTCLOUD_OVERWRITEHOST, NEXTCLOUD_OVERWRITEWEBROOT according to https://docs.nextcloud.com/server/13/admin_manual/configuration_server/reverse_proxy_configuration.html