The Nextcloud Server is hosted on my server on port 8285 for https and 8284 for http. which is redirected to port 80 and 443 respectively when it leaves my local network and enters the www. However, when I type in my URL lets call it truenas.com i get redirected to truenas.com:8285 and get a “Cannot load your page” Error from my Browser. Correct port internally, wrong Port externaly. I should mention I am behind a double NAT so I use a SSH tunnel and a cloud hosted server to tunnel the trafic to the outside world.
Inside the jail/container check the environment variable OVERWRITEHOST. I’m not sure how it’s getting set for me, but that seems to be the cause of the port redirect. On Scale the container is given that environment variable and nextcloud accepts it and uses the environment variable over anything else set in the config.
Posted too soon. On TrueNAS Scale the problem was caused by filling in the config field “Host”. If that field is blank then the environment variable is not set. If that field has anything in it then the environment variable is set by combining that field and the “Web UI Port” field which has to be the internal port.