What the message looks like
The reverse proxy header configuration is incorrect. This is a security issue and can allow an attacker to spoof their IP address as visible to the Nextcloud.Common causes
- Nextcloud runs behind nginx, Apache, Traefik, HAProxy or a Docker proxy, but
trusted_proxiesis not set inconfig.php. - The proxy does not send
X-Forwarded-For,X-Forwarded-ProtoandHost. overwriteprotocoloroverwrite.cli.urldo not match the public address (http against https).- More than one hop, for example Cloudflare, then nginx, then the Nextcloud container, and only one of them is trusted.
- The opposite case: there is no proxy, but
trusted_proxiesstill lists an old address.
Check
- Which proxies does Nextcloud trust?
- Is the protocol forced correctly?
sudo -u www-data php occ config:system:get overwriteprotocol - Which headers does the proxy set?
grep -rnE 'proxy_set_header|X-Forwarded' /etc/nginx/ - What address does the app see for you? (Settings → Administration → Overview shows the warning)
curl -sI https://cloud.example.com/status.php
Fix
- Add the proxy's address:
sudo -u www-data php occ config:system:set trusted_proxies 0 --value=192.0.2.10. Use one index per proxy. - Force the public protocol:
sudo -u www-data php occ config:system:set overwriteprotocol --value=https. - Make the proxy send the headers:
proxy_set_header Host $host;,proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;andproxy_set_header X-Forwarded-Proto $scheme;. - Behind Cloudflare, add Cloudflare's address ranges to
trusted_proxiesand setforwarded_for_headerstoHTTP_CF_CONNECTING_IP. - If there is no proxy, remove
trusted_proxiesandforwarded_for_headers.
Typical scenario
Nextcloud runs as a Docker container behind Nginx Proxy Manager. The admin overview shows the reverse-proxy warning, and in nextcloud.log every request has remoteAddr 172.18.0.1. That is the Docker bridge, not the visitor. Open a log line, note the address under remoteAddr and check with occ config:system:get trusted_proxies whether exactly that address is listed. Only then look at the proxy configuration, since that is where the headers Nextcloud evaluates come from. Do not touch overwritehost before you know the address.
FAQ
Why is this called a security issue?
Nextcloud only believes the forwarded IP from trusted proxies. Otherwise anyone could send a fake header and hide behind a false address, which also defeats brute-force protection.
Why does every user show the same IP?
Because the proxy's address is what Nextcloud sees. Then the brute-force protection can throttle all users at once, see too many requests.
Which address do I enter in trusted_proxies with Docker?
The address from which Nextcloud sees the proxy's requests, which is remoteAddr in the log. With Docker this is often the gateway or the IP of the proxy container in the shared network. You can also use a range in CIDR notation, such as the proxy's Docker subnet.
Does the warning disappear if I only set overwriteprotocol?
No. overwriteprotocol fixes the scheme, so https instead of http in generated links. The warning concerns trust in the proxy and the X-Forwarded-For header. You usually need both settings; each fixes a different symptom.
What changes when two proxies sit in a row?
Then every proxy that appears in the chain must be listed as trusted, otherwise Nextcloud takes the entry of the untrusted hop as the client address. Which headers are read is controlled by forwarded_for_headers; the default is X-Forwarded-For.