Error when updating trusted_domains

Each time my ncp reboots, an IPv6 entry is added to the trusted_domains array. However, this IPv6 entry is not enclosed in square brackets (as is apparently required).

Having this unbracketed IPv6 address in the array will cause an error in the ā€˜Security and Setup Warnings’ of the administration overview. If I manually edit config.php, then the error goes away, but if the server reboots, then the error will come back.

The Basics

  • Nextcloud Server version 30.0.4.1
  • ncp v1.55.3
  • Operating system and version Armbian 24.11.2 bookworm \l . 6.6.63-current-bcm2711 (aarch64)
  • PHP version 8.3
  • Is this the first time you’ve seen this error? Yes
  • When did this problem seem to first start?
    • unsure - a week or so
  • Installation method NCP
  • Are you using CloudfIare, mod_security, or similar? No

Summary of the issue you are facing:

see above

Steps to replicate it (hint: details matter!):

  1. visit the admin panel (port 4443), and review nc-trusted-domains (in my case I have a [hostname].ddns.net, nextcloudpi.local and my local 192.168.x.x addresses
  2. open config.php and inspect the trusted_domains array. In my case there are additional entries not visible from the webpage, including localhost and an IPv6 address, which is in square brackets (because I placed the square brackets there manually)
  3. reboot the machine
  4. After reboot, view the config.php file again
  5. Notice that the IPv6 address is duplicated in the trusted_domains array, but it is NOT in square brackets
  6. Log into your server as admin and visit the ā€˜Administration… Overview’ page, and notice the big red error about your trusted_domains being misconfigured.
  7. Manually remove the IPv6 entry from the trusted_domains array with nano
  8. Refresh the Administration… Overview page and notice that the error has gone away.
  9. Keep in mind that if/when your server reboots, you’ll get the same error again.

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

pi@nextcloudpi:~$ sudo more /var/www/nextcloud/config/config.php
<?php
$CONFIG = array (
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    3 => 'nextcloudpi',
    4 => '[2603:7000:d700:facb:bfa4:26bd:7e85:d0c7]',
    20 => '',
    21 => 'nextcloudpi.local',
    22 => '192.168.0.20',
    14 => 'nextcloudpi',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'password' => '',
  ),
  'datadirectory' => '/media/nextCloudDrive/ncdata',
  'overwrite.cli.url' => 'https://nextcloudpi/',
  'dbtype' => 'mysql',
  'default_phone_region' => 'US',
  'version' => '30.0.4.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'instanceid' => 'ocblr2m190u4',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '',
  'mail_domain' => '',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => '2',
  'jpeg_quality' => '60',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => '',
  'mail_smtpport' => '465',
  'data-fingerprint' => '',
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
    1 => '::1',
    11 => '127.0.0.1',
    12 => '::1',
  ),
  'tempdirectory' => '/media/nextCloudDrive/ncdata/tmp',
  'logfile' => '/media/nextCloudDrive/ncdata/nextcloud.log',
  'htaccess.RewriteBase' => '/',
  'log_type' => 'file',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'mail_smtpsecure' => 'ssl',
  'maintenance_window_start' => 8,
);

Sounds like this:

Yes. That certainly seems to fit. Guess I’ll start following that issue. In the meantime, what is the right way to handle this issue that I’ve opened here?

Thanks!