Nextcloud trusted proxies

what did you put in config.php to prevent the error The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy ?
I’ve tried with the apache image , the nginx web server and now with caddy web server.
They all run in a pod behind a seperate caddy reverse proxy.

so I can only conclude that its an issue with my config.php

this is the relevant bit of my config.php

  'trusted_domains' => 
  array (
    0 => '192.168.1.160:5080',
    1 => 'mynextcloud.duckdns.org',
  ),
  'trusted_proxies' => 'http://192.168.1.160:8080',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.4.1',
  'overwrite.cli.url' => 'https://mynextcloud.duckdns.org',
  'overwriteprotocol' => 'https',

my reverse proxy caddyfile looks like this

mynextcloud.duckdns.org {
        encode gzip

        header Strict-Transport-Security max-age=15552000;
        reverse_proxy http://10.0.2.2:5080
}


I use the addresss 10.0.2.2 because I have caddy cofigured with --net slirp4netns:allow_host_loopback=true,port_handler=slirp4netns instead of --network=host

strangely my nextcloud shows the al the request in the log coming from localhost

127.0.0.1 -  22/Mar/2023:17:50:14 +0000 "GET /ocs/v2.php" 304

127.0.0.1 -  22/Mar/2023:17:50:44 +0000 "GET /ocs/v2.php" 304

127.0.0.1 -  22/Mar/2023:17:51:43 +0000 "PUT /ocs/v2.php" 200

I assume this is because it sees only requests from the caddy webserver.

This should be an array of IP addresses, not a string URL. See the Nextcloud docs Reverse proxy — Nextcloud latest Administration Manual latest documentation

Try this:

'trusted_proxies' => ['192.168.1.160'],
1 Like

I cant believe it , I’ve been struggling with that for days now and it was a simple as that. Thank you so much for your help

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