Set APACHE_DISABLE_REWRITE_IP=1 after install?

I’m migrating my nextcloud installation to docker (docker compose). I’m using Traefik as a reverse proxy and I have associated a domain with my nextcloud instance.

The documentation tells me to set APACHE_DISABLE_REWRITE_IP=1 and TRUSTED_PROXIES=traefik documentation.

The problem is that I started, installed and ‘filled’ nextcloud before setting these environment variables. Hence when visiting nextcloud from my domain I get " Access through untrusted domain". I have set the trusted proxies in the config.php file:

  'trusted_proxies' =>
  array (
    0 => 'traefik',

Next I should set APACHE_DISABLE_REWRITE_IP=1 in the config.php file.

But how and where should I set APACHE_DISABLE_REWRITE_IP=1 inside config.php?

I know I can just add the domain to the trusted domains section but I would like to keep things dynamic so I can change the domain at will.

try to rebuild your Nextcloud container. Once you start with fresh container it should adopt changed environment variables.

I know, but I would like too keep my data and the contents of the database :slight_smile:

Is there a way to do it without starting with a fresh container?

Rebuilding container doesn’t mean you loose data. there should be no persistent data inside of the container. All settings and data expected to exists outside and inject as env values, secrets and volumes, so generally speaking until you build the container completely wrong it’s safe to drip the container and start with fresh one. Data should be mapped as volume and DB is a differnt container in all tutorials i remember. If you care about the data you sitiuation if good to start thinking of good backup strategy which includes periodical restore testing.