Change Share Link to use DNS Name

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version 15.0.4:
Operating system and version FreeNAS-11.2-RELEASE-U1:
Apache or nginx version nginx 1.14.2:
PHP version 7.1.26:

The issue you are facing:

I have setup a brand new NextCloud plugin within FreeNAS using the FreeNAS plugin menu. When I attempt to share a file by using a link, I get the link I want the link generated to use a DNS name rather than using the private IP address.

I have added a DNS name to the trusted_domain section of the config and even set the overwrite.cli.url option to have the DNS name. However, after restarting the plugin, there is no change to the share links that I create, either for the same files or new files.

The question is what configuration changes need to be made so that when I share a file using a link, the link will have the DNS name rather than the private IP address?

Is this the first time you’ve seen this error? Y:

Steps to replicate it:

  1. Setup NextCloud using default settings, a private IP Address and no use of DNS names
  2. Share a file using Link
  3. Review the link to show it using a private IP Address

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/local/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    1 => 
    array (
      'path' => '/usr/local/www/nextcloud/apps-pkg',
      'url' => '/apps-pkg',
      'writable' => true,
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'instanceid' => 'oc19p52m1xag',
  'passwordsalt' => 'v/XNejlmImpfMSWyDN7VORrmcJ9RvZ',
  'secret' => 'urScqWOjQaRp9uktQTwAZB4sErA6qv8s7Dph5fAOKD2zbgvN',
  'trusted_domains' => 
  array (
    0 => '<A domain name>',
    1 => '',
  'datadirectory' => '/mnt/storage',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '<A doamin name>',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_<db admin account>',
  'dbpassword' => 'IjOLMcUU+5wtGHNgdUTNRaOW/2jp0+',
  'installed' => true,
1 Like

I had the same issue. Needed to add the following to config.php

'overwrite.cli.url' => 'https://domain.tld/',
'overwritehost' => 'domain.tld',
'overwriteprotocol' => 'https',

This solution ALWAYS overwrites the hostname / protocol in the URL. It is not a solution to the stated problem which was to be able to change the domain name only for files that are shared.

The stated problem seems like it should be fairly common. In my case, I have a Nextcloud server on a private network. The same server is accessible via a public domain name using a reverse proxy. The server is MUCH faster when accessed over the private network. But no one can share from the private network since share link include a private IP for the share domain. So, everyone is forced to use the much slower public domain just to allow sharing with users outside the private network.

Is there really no solution to such a simple problem??