Nextcloud + Cloudflare Tunnel css or js not being loaded

Images are probably better to describe my issue. I’ve installed Nextcloud + Cloudflare Tunnel, URL works, already had a domain so using subdomain. The problem starts after I login into Nextcloud.
See the attached image. On local all good, on (proxied?) URL via cloudflare something gets broken while loading, either CSS or JS.
Am I forgetting to add something on config.php? Please help!


I got a similar issue because the CF tunnel pointed properly to the server but only the NextCloud background image was loaded at my custom domain without the login form so I couldn’t even login and after trying all kind of workarounds with the Cloudflare tunnel settings and NextCloud config file I gave up and decided to access it over tailscale and it works nicely for remote access.
I just reopen the thread since it had no answer and if I could access over the CF tunnel I would prefer it because of the HTTPS support native on Cloudflare which is a limitation when syncing with other apps and to avoid running tailscale permanently on each of the remote devices accessing NextCloud

Double check the config.php in Nextcloud, especially the “trusted_domains” and “SSL settings” in Cloudflare. There may be a firewall blocking the traffic or there may be a caching issue. Since Tailscale works, the problem is probably in the tunnel setup.