Nextcloud App uses hostname for public links

Nextcloud version (eg, 20.0.5): 24.0.4snap1 Rev 31563
Nextcloud Windows Desktop App: 3.4.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
PHP version (eg, 7.4): replace me
snap version: 2.57.2
snapd version: 2.57.2

The issue you are facing:
We are using nextcloud for our company data. Nextcloud can be accessed over a public subdomain and over an VPN but this is not the normal use case. We are using the Nextcloud Windows Desktop App. We are sharing files with clients over public links which we create from the windows context menu.
We moved our nextcloud installation behind a nginx reverse-proxy a while ago and now the nextcloud creates two different types of links. For the public link it creates a link with the hostname as domain and for private internal links it creates a link with the correct domain name. So in my opinion the wrong way around. The web app does not, here it works fine. In the mobile & desktop panel in the settings menu there is also the hostname stated as server address. Some redirect links, like for password reset or in notification e-mails, the hostname is also used as domain and not the official subdomain.

The trusted_domain array looks like this:

'trusted_domains' =>
  array (
    0 => 'cloud.domain.tld',
    1 => 'hostname',
    2 => 'private ip-address',

For now we tried to:

  • Set the correct domain in the trusted_domains setting
  • Remove the hostname from the /etc/hostname file
  • Set the overwritehost and overwrite.cli.url value in the config.php file

All with no success. Is there any second place where the server address is stored?

Is there any special forum for the snap installation as this is not an official package?

I do not know if a log would help, so for brevity i skipped that. But I would be happy to share some if this can help!

Thanks a lot!

trusted_domains has nothing to do with the links (it is used to see if the incoming request is valid for this host).

is the right setting. Please double check if you missed something from Reverse proxy — Nextcloud latest Administration Manual latest documentation

Ideally, you should use only the public subdomain, with split-horizon DNS.

As it seems only the overwritehost settings fixed it. Thank you for your help!