Nextcloud podman behind caddy reverse proxy configure correctly

Hi ,

I’m really struggling to get the configuration right, I have the common error The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If not, this is a security issue and can allow an attacker to spoof their IP address as visible to the Nextcloud in my nextcloud frontend.

I can access nextcloud remotely via its domain name , so i know the reverse proxy is working , I assume the error is that the trusted proxies isn’t configured correctly, I thought that it would be localhost considering my caddy reverse proxy is running using network=host

i’ve tried several configuration options in config.php but none seem to work.

my caddyfile entry is :

mynextcloud.duckdns.org {
    rewrite /.well-known/carddav /remote.php/dav
    rewrite /.well-known/caldav /remote.php/dav

    header Strict-Transport-Security max-age=15552000;
    reverse_proxy localhost:5080
}

and my config.php

'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.1.160', #IP of the server running podman 
    2 => 'mynextcloud.duckdns.org',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.4.1',
  'trusted_proxies'   => 'localhost',
  'forwarded_for_headers' => 'HTTP_X_FORWARDED_FOR',
  'overwrite.cli.url' => 'https://mynextcloud.duckdns.org',
  'overwriteprotocol' => 'https',

I’m using the apache nextcloud image from dockerhub
thanks in advance for any advice

trusted_proxies should be IP addresses.

Try 127.0.0.1

https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/reverse_proxy_configuration.html

1 Like

I never managed to get it working properly with the Apache image , show I used the fpm image instead, it all works perfectly now, but thanks for the help.

As I understand it now it should have been an array instead of a string in the trusted proxies section.