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 : {
    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 => '', #IP of the server running podman 
    2 => '',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'trusted_proxies'   => 'localhost',
  'forwarded_for_headers' => 'HTTP_X_FORWARDED_FOR',
  'overwrite.cli.url' => '',
  'overwriteprotocol' => 'https',

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

trusted_proxies should be IP addresses.


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.