[TrueNas] Access Nextcloud both from local IP as well as Domain via Cloudflare tunnel

I am using TrueNAS scale, and I am trying to use my Nextcloud app from both my home with full local speed and also via my domain via Cloudflare tunnel while I am not at home.

The problem is if I don’t change any setting for the app it will redirect me to localip:9001, which of cause does not work when I am not at home.

The solution I found online is to set the environment variable to “OVERWRITEHOST” and “OVERWRITECLIURL” to my cloudflare domain name. Doing this results in me being able to access the nextcloud instance via my cloudflare domain, but now I am unable to access it via my local ip at home. The solution to this problem suggested by some is to use the host file on my pc and set the cloudflare domain to my localip. This does not work because the local port is 9001, and I am redirected to the 443 port set implicitly in the OVERWRITEHOST enviorment variable by entering the cloudflare domain without any port.

Is there anyway I can make it so that I can access the nextcloud instance both through the Cloudflare tunnel domain, and my localip?

hi @00pflaume welcome to the community :handshake:

you don’t want to have such setup. reasons have been often discussed.

the solution is to use public domain internally as well but avoid the loop using “Split brain DNS” splitbraindns e.g. like explained here Lost acces from inside LAN - #14 by wwe

1 Like