Using port 444 for SSL with NextcloudPi

Installed NextcloudPi on a Raspberry Pi 4 running Ubuntu 64-bit.
ISP blocks port 443, so used nginx to listen for SSL on port 444.
Can access nextcloud with nextcloud.domain.tld:444 from the internet.

But, whenever I get a response from the nextcloud server, it removes the port 444 and the page breaks. I have to manually add the :444 everytime. This is an inconvenience but not a deal breaker.

The real issue comes when I’m trying to grant access to apps to my nextcloud instance (floccus, antennapod, etc). I start the process and it redirects me to the login page(w/out the :444, which I add manually and it works). On the Grant Access page, the form is blocked by Content Security Policy presumably because the POST request it is sending doesn’t contain the :444 whereas the url of the page does. No problem, I edit the html and click the grant access button. I am redirected successfully to the access granted page— but, the floccus app doesn’t register it.

In fact, the very first time it opens the page, I get the “NetworkError when attempting to fetch resource.” on the floccus page itself.
Why is this happening?
How can I solve it so that, my server always returns the domain with the port number 444?

Here is the response from the call made by floccus to my server -

Request Headers=

Header Value
scheme https
host nextcloud.domain.tld:444
filename /index.php/login/v2

Response =


So clearly the request is going to the nextcloud.domain.tld:444, but the url it returns with doesn’t contain the port number. How do I solve this?

I guess they only block port forwarding of port 443, right?
In that case you can aquire a second router and configure it as DMZ and do the port forwarding from there.

I’m personally not using NextcloudPi, but it might be necessary to set the non-default port in your Nextcloud configuration file (config.php), like e.g.

  'overwritehost' => '<fqdn>:444',
  'overwrite.cli.url' => 'https://<fqdn>:444',