Your "trusted_proxies" setting is not correctly set, it should be an array of IP addresses - optionally with range in CIDR notation

Hi there,

I am facing the “Your “trusted_proxies” setting is not correctly set, it should be an array of IP addresses - optionally with range in CIDR notation.” since version 29.

My config in config.php looks like this:

  'trusted_proxies' =>
  array (
    0 => '172.18.0.3',
  ),

It worked with nextcloud 28.x and I already checked a lot of other resources on this topic. I have an array and I have only an IP adress, no hostname or gethostbyname calls or anything. Still I cannot pass the newly introduced test.

Also checked the source code of the check and can confirm that this IP should pass the test. filter_var(‘172.18.0.3’, FILTER_VALIDATE_IP) is true.

So why do I keep getting this error?

Thanks

hi @Joern_Hoos welcome to the community :handshake:

in my installation I have an IP mask like /32 /16 and /10 (for IPv6) included - maybe this will do a trick

occ config:system:get trusted_proxies
172.16.0.0/12
192.168.0.0/16
10.0.0.0/8
fc00::/7
fe80::/10
2001:db8::/32

CIDR notation seems to consist of IP address and mask - the check might be little stronger with nc29 than it was before…

1 Like

Please run occ config:list system --private or equivalent in your environment to see the parsed and aggregated configuration.

Thanks, but yes, I already tried it with an included range too.

Thanks. That gave me a helpful hint. The output was double quoted and escaped.

        "trusted_proxies": [
            "[\"172.18.0.3\/32\"]"
        ],

Wondered where that came from and found an error in my docker compose config, which lead to the proxy config from docker not being applied. Fixed that and now the config is overwritten with the docker compose config and is just the quoted IP address as expected.

The error message is gone. Thanks.

2 Likes

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