Reverse proxy config with podman and Caddy

So I wonder if you could help me , I’m running Nextcloud using podman , so rootless, as you say APACHE_DISABLE_REWRITE_IP=1doesn’t seem to work. I can acccess nextcloud through my caddy reverse proxy no problem , however I get the error The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy in the overview tab of nextcloud. I tried you solution of mounting remoteip.conf and apache2.conf I didnt have redis setup so i didn’t need the other mounted volume you show.

This is my altered line in apache2.conf

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" [%{X-Forwarded-For}i] [%{X-Real-Ip}i]" combined

and this is my altered remoteip.conf

RemoteIPHeader X-Real-Ip
RemoteIPInternalProxy 10.0.0.0/8
RemoteIPInternalProxy 172.16.0.0/12
RemoteIPInternalProxy 192.168.0.0/16

and this is the relevant part of my config.php

'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.1.160',
    2 => 'mynextcloud.duckdns.org',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.4.1',
  'overwrite.cli.url' => 'https://mynextcloud.duckdns.org',
  'default_phone_region' => 'GB',
  'overwriteprotocol' => 'https',

however in my nextcloud logs I still get the container IP of my caddy reverse proxy 10.0.2.100

is there some other setting I should be changing ?

as i understand it caddy has X-Forwarded-For on by default

thanks in advance for your help

@greylinux1 - I split your topic into separate thread as it doesn’t relate to Apache Docker Wiki article.

is just for logging purposes…you don’t really need to change it. as described this was intermediate stop on the way to the solution…

then likely you need to either adopt remoteip.conf or caddy config…

I’m missing the overwritehost parameter. you should add this as well-

1 Like

Thanks for the reply , I managed to get it working with caddy as the webserver in the end , I could never get it working properly with the apache image. Thanks for your help though really appreciate it.

glad get it sorted. Would be great you post your working config for others as reference.

I wrote a tutorial instead , hope this can help others.

2 Likes