Nextcloud redirects to wrong port, when in the open internet

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.

Any help would be appreciated