In your config/config.php you can specify which hostname you prefer to use. For your purpose, the first should be sufficient, but I’m not sure if such auto-generated messages take the address from the other variable.
* The automatic hostname detection of Nextcloud can fail in certain reverse
* proxy and CLI/cron situations. This option allows you to manually override
* the automatic detection; for example ``www.example.com``, or specify the port
'overwritehost' => '',
* Use this configuration parameter to specify the base URL for any URLs which
* are generated within Nextcloud using any kind of command line tools (cron or
* occ). The value should contain the full base URL:
* Defaults to ``''`` (empty string)
'overwrite.cli.url' => '',
I have NC running fine on www.domain.com, and I want that domain to be the good one, the thing I want is when NC generates an URL from sharing files (or any sharing method) it does not use the primary domain but another one, like www.domainalternative.com. So, if now I share a link with email user, this user receives an email with the following linked URL:
The problem I have is that my users access NC via HAProxy with required Client Certificates authentication; If I share a link the external users should need a certificate to access that link, because the URI is the same for domain name and the traffic passes through the Proxy.
So, I had though the best way is that NC generates the links on other domain, so that I can bypass the traffic for that domain and there’s no need to set TLS authentication for that domain.
That feature on github is similar to this problem, but I don’t know how to bring it up to mine
You could open a new topic asking for a sharing domain. One purpose was the a usercontent-domain to include stuff in your website, but also your purpose of using an authentication mechanism on the main domain.
Can’t you specify a filter that doesn’t ask for this authentication when you open www.example.org/s/...?
First the good news: I have found the PHP code that creates shared links and modified it to return an external domain name for the shares link if one is configured in config.php. I have checked with a php debugger and it seems to work perfectly. The modified code is in apps/files_sharing/lib/Controller/ShareAPIController.php. I modified the formatShare() function to add this functionality.
I have created this enhancement request:
If the use case / solution matches your issue, please give it a thumbs up.
I have fixed this issue in my Nextcloud version which is based on Nextcloud 21.0.0. It works great!!!
Using this feature, anyone with a local server and an HTTP proxy can share files from the local server using URLs which point to the HTTP proxy.
I have closed the enhancement request listed above in this thread.
I would be happy to offer the changes I made to implement this feature to anyone who is interested in adding this feature to the Nextcloud trunk.
I would like to see your solution. (Even better would be for it to be incorporated into the regular distribution.)
To clarify my use case:
We generally access Nextcloud in the browser over the local, on premise network (also sometimes through VPN) using the local IP address. But “public” access is though a domain. It seems that the default behavior of NextCloud when creating a public share link, is to use the root domain that is being used for that particular log in. So, if I log in with the local IP address and enable a share for a file, the local IP address is the domain used in the link that is generated. But if I log in via the public domain and create (or even just copy an already existing sharing link), then the link is generated with that public facing domain.
Ideally, there would be a preference for the preferred domain for links like this in the config.php file. That way, when a local network user wants to publicly share a file with a link, they don’t have to log out of the site on the local network and then re login through the public facing domain.