[SOLVED] Theming app not updating theme behind reverse proxy

Nextcloud 15.0.5
Centos 7
Nginx (Webserver amd reverse proxy)
PHP 7.2

Problem with : Theming 1.6.0

I find myself unable to use the theming app to change my nextcloud’s theme. Locally I can edit everything without any trouble but the moment I make it available behind my reverse proxy, it just does not happen. I am not interested in using the theme folder as it’s really just to change colour when I feel like it.

I have another nextcloud (14.0.1) instance running that does not have this problem even though they are configured the same way, except for versions. Theming app version 1.5.0.

There are no error in the logs.

config.php

  'trusted_domains' =>
  array (
        0 => '192.168.0.14',
        1 => 'example.org',
  ),
  'datadirectory' => '/data',
  'dbtype' => 'mysql',
  'version' => '15.0.5.3',
  'trusted_proxies' =>
  array (
    0 => '192.168.0.19',
  ),
  'overwrite.cli.url' => 'https://example.org',
  'overwritehost' => 'example.org',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/nextcloud',
  'overwritecondaddr' => '^192\.168\.0\.19$',
  'memcache.locking' => '\OC\Memcache\Redis',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.local' => '\OC\Memcache\Redis',
  'redis' =>
   array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 3,
  ),

Reverse Proxy config

location /nextcloud/ {
        proxy_pass      http://192.168.0.14/;
        add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
        proxy_set_header        Host                    $host;
        proxy_set_header X-Forwarded-Host $host/nextcloud;
        access_log      /var/log/nginx/cloud.access.log;
        error_log       /var/log/nginx/cloud.error.log;
        client_max_body_size    0;
        proxy_set_header        X-Real-IP               $remote_addr;
        proxy_set_header        X-Forwarded-For         $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto       $scheme;
}
1 Like

I believe this has to do with caching on reverse proxy. I have a docker deployment and have the same issue (which lead me to your post), however it turns into a text based mess with no formatting. Over time it works it self out (obviously, not ideal). Restarting the reverse proxy container and it takes the changes almost immediately for me.

There is no cache configured on the reverse proxy, so I went back to check the difference between the two servers and this line seemed to be a problem :

        proxy_set_header X-Forwarded-Host $host/nextcloud;

With that line in the reverse proxy config my “overwrite.cli.url” ended up as “https://example.org/nextcloud/nextcloud
Taking out that line it is now back to normal at “https://example.org/nextcloud” AND the theming is working BUT, now css is not working. How do I know theming is working if I get no css? The favicon changed color.

I am now playing around to figure out what kind of shenanigans I can spoof up to make both work…

Continuing from my last reply, after taking out the “X-Forwarded-Host” and playing around a bit (not changing anything) css came back up! But then it went back out again so it’s most likely a cache problem. I changed the REGIS cache to APCu and it’s back again.

I have a “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. Further information can be found in the documentation.” warning, it’s always been there and except taking out the “overwrite” configurations in Nextcloud’s config.php, nothing seems to make it go away.