Remote address is proxy address instead of real client

I’m running nginx as reverse proxy and TLS endpoint on my server and apache with nextcloud in a container.
It looks like Nextcloud takes the proxy IP as client IP:

  • Your remote address was identified as “192.168.227.161” and is brute-force throttled at the moment slowing down the performance of various requests. If the remote address is not your address this can be an indication that a proxy is not configured correctly. For more details see the documentation :up_right_arrow:.

In my nginx config I have:

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $remote_addr;
proxy_set_header X-Real-IP $remote_addr;

In my apache config, I have:

RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 192.168.0.0/16

And in my Nextcloud config.php, I have:

'forwarded_for_headers' => ['HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR'],
'trusted_proxies' => ['192.168.0.0/16'],

I’m sure, I’m missing something, but what?

TIA!

Staring at the configs for long enough time, I found my error.

HTTP_X_FORWARDED_FOR was missing in forwarded_for_headers in config.php.

Sorry for the noise!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.