Trusted_proxys not working

Hello everyone,

i have a small issue.

I run nextcloud 22 behind a proxy.
The reason is that nextcloud runs at home, but has a proxy on a server on the internet, both are connected via a vpn.

The vpn ip of the proxy is 10.23.42.1 and the nextcloud server has 10.23.42.4.

I have set the trusted_proxy var according to: https://docs.nextcloud.com/server/22/admin_manual/configuration_server/reverse_proxy_configuration.html

to:

  'trusted_proxys' => 
  array (
    0 => '172.18.0.0/16',
    1 => '10.23.0.0/16',
    2 => '192.168.2.0/24',
  ),

But i still get this error message:
grafik

The Header configuration seems to be fine since the output of this php script (when i put it right next to the nextcloud instance):

<?php

foreach (getallheaders() as $name => $value) {
    echo "$name: $value\n <br />";
}
echo $_SERVER['REMOTE_ADDR']

outputs the correct headers (redacted with XXXXX but the forwarded for and remote_addr both have my actual ip in there)

Connection: upgrade
Host: nextcloud
X-Forwarded-For: XXXXX
X-Forwarded-Proto: https
X-Forwarded-Host: XXXXX
X-Forwarded-Port: 443
user-agent: XXXXX
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
accept-language: de,en-US;q=0.7,en;q=0.3
accept-encoding: gzip, deflate, br
upgrade-insecure-requests: 1
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: none
sec-fetch-user: ?1
cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=XXXXX; nc_token=XXXXX; nc_session_id=XXXXX; oc_sessionPassphrase=XXXXX
REMOTE_ADDR XXXXX

Can anyone spot my mistake here?

All the best, Nicolas

Hi Nicolas,

I just noticed a typo in your config. Try trusted_proxies instead of trusted_proxys.

All the best and good luck.

2 Likes

So, i just spend a few hours trying to debug that issue.

And it never occured to me that i wrote it wrong.

Thank you!