You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All requests originate from 172.19.0.2 instead of the incoming IP. The main undesirable side effect is that failed login attempts are all attributed to the same IP regardless of their actual origin, causing login/uploading one image has an added delay of about ~30 seconds.
I had to apply this patch manually to the insecure docker examples. Any reason why those were excluded ? I use the insecure docker image with a host nginx reverse proxy. So it still affects that.
Not sure this should be closed. There is more than just using mod_remoteip that needs changing. I am using the 14.0 image, and on that platform, you ALSO need to change the LogFormat directive in apache2.conf to use the %a variable instead of the %h variable to log to proper client IPs.
I have the same setup as @bfayers and also having the same issue. In the past I had used mod_rpaf in Apache to get actual client addresses. It seems there should be more than just mod_remoteip configuration. Can anybody fix this in Nextcloud Docker image?
Is there something additional to do if someone uses an apache2 reverse proxy in front of the nextcloud docker - apache2 image? It just doesnt work for me. :(
For my knowledge mod_proxy / mod_proxy_http should add the needed headers (X-Forwarded-For) automatically. But in the docker logs it shows still the gateway address of the docker network. Any ideas?
I am facing the same issue with not seeing the visitors ip in the nextcloud container behind a reverse proxy container. My solution used to be to run the reverseproxy with --net=host and to add the header to the logsettings for the virtual host. Docker bridge networking does not pass the headers through.
I did some digging on this issue. The reasons why it appears to be not working.
docker logs don't show the correct client ip. This is because the log format needs to be changed. However since there is a proxy already, you can rely on its log instead of docker logs which is recorded by the apache. Note that the nextcloud logs does have the correct client ip.
For anyone experiencing the same problem, try to access Nextcloud with your phone over mobile internet; the remote IP showed up correctly. Had been scratching my head for over an hour why I couldn't see my real (internal) IP address, but #294 (comment) was right on point.
Activity
[-]All requests originate from 172.19.0.2[/-][+]All requests originate from 172.19.0.X[/+]chm commentedon Mar 27, 2018
I've got almost the same issue before.
This is due to a security check, NC can't tell if it's true when a same IP says it's a rev-proxy, and keeps login on behalf of someone unlimited.
The solution must match with the rev proxy setup, and I handled it this way:
<?php$CONFIG = array ('trusted_proxies' => array('172.32.0.1',),);as docker put host as nat gateway on 172.32.0.1
And for your issue, with a container as nginx proxy:
pierreozoux commentedon Mar 27, 2018
We solve it at the nginx level:
But this is difficult to fix it for everybody as this address depends on your setup.
I hope that by moving to k8s we'll find a nicer workaround.
tilosp commentedon Mar 27, 2018
we could simply allow any rfc1918 address
this should fix it for most people
@pierreozoux are you sure that
ngx_http_realip_moduleis part of the nginx image?pierreozoux commentedon Mar 27, 2018
Good idea @tilosp :)
Yes, for the debian and alpine version \o/
7 remaining items
bfayers commentedon Apr 15, 2018
@dachary Still not sure..
Solved with:
apt-get install libapache2-mod-rpaf(thanks to: https://www.daveperrett.com/articles/2009/08/10/passing-ips-to-apache-with-nginx-proxy/)
a2enmod rpafdocker restart nextcloudNow proper ips show up
pgera commentedon Oct 3, 2018
I had to apply this patch manually to the insecure docker examples. Any reason why those were excluded ? I use the insecure docker image with a host nginx reverse proxy. So it still affects that.
mossholderm commentedon Oct 4, 2018
Not sure this should be closed. There is more than just using mod_remoteip that needs changing. I am using the 14.0 image, and on that platform, you ALSO need to change the LogFormat directive in apache2.conf to use the %a variable instead of the %h variable to log to proper client IPs.
nightspotlight commentedon Nov 18, 2018
I have the same setup as @bfayers and also having the same issue. In the past I had used mod_rpaf in Apache to get actual client addresses. It seems there should be more than just mod_remoteip configuration. Can anybody fix this in Nextcloud Docker image?
bonanza123 commentedon Dec 25, 2018
#294 (comment)
Fixes it for me as well. Would be nice to have it in the official image
DatAres37 commentedon Jan 10, 2019
@bfayers Do you mind sharing your whole config? I'm using the jwilder proxy as well, but nextcloud.log still shows private IPs.
Edit: Nvm, got it working. I had multiple Forwarded-For Headers in my config, which apparently breaks this function.
TheReal1604 commentedon Jan 16, 2019
Is there something additional to do if someone uses an apache2 reverse proxy in front of the nextcloud docker - apache2 image? It just doesnt work for me. :(
For my knowledge mod_proxy / mod_proxy_http should add the needed headers (X-Forwarded-For) automatically. But in the docker logs it shows still the gateway address of the docker network. Any ideas?
cs33lm commentedon Jan 17, 2019
I am facing the same issue with not seeing the visitors ip in the nextcloud container behind a reverse proxy container. My solution used to be to run the reverseproxy with --net=host and to add the header to the logsettings for the virtual host. Docker bridge networking does not pass the headers through.
godfuture commentedon Mar 13, 2019
Why is this ticket closed? The nc images still have this bug. Bruteforce detection does not work when using docker in regular way.
robfuscator commentedon Apr 25, 2019
From the docs: https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/reverse_proxy_configuration.html
Solved it for me
balki commentedon Aug 9, 2019
I did some digging on this issue. The reasons why it appears to be not working.
docker logs don't show the correct client ip. This is because the log format needs to be changed. However since there is a proxy already, you can rely on its log instead of docker logs which is recorded by the apache. Note that the nextcloud logs does have the correct client ip.
If you are testing it from an internal ip (e.g. 192.168..) , it won't work. For this to work, the conf should use a different directive. https://httpd.apache.org/docs/trunk/mod/mod_remoteip.html#remoteipinternalproxy
Solution:
Use the 'trusted_proxies' config option to specify directly in nextcloud.
https://gitlab.com/snippets/1884088
On a side note, I recommend configuring overwriteprotocol to https. Without this the file share links generated are http ones and thus can be trapped.
melyux commentedon Sep 14, 2019
I simply added
172.0.0.0/8totrusted_proxies, and it worked, since my reverse proxy is on another docker container.EDIT: Never mind, the IPs in the logs still show the local nginx reverse proxy container's 172.8.x.x. IP. But adding @tilosp's lines worked.
SuperSandro2000 commentedon Jun 1, 2020
You need to disable the Docker Userland proxy to get the real client IP. Otherwise all requests will originate from the gateway.
woutergrimme commentedon Apr 20, 2021
For anyone experiencing the same problem, try to access Nextcloud with your phone over mobile internet; the remote IP showed up correctly. Had been scratching my head for over an hour why I couldn't see my real (internal) IP address, but #294 (comment) was right on point.