Access through untrusted domain. Cloudflare tunnel. Config.php updated. Help?

Nextcloud version (eg, 20.0.5): 27.1.4 (Linux Server Docker Image)
Operating system and version (eg, Ubuntu 20.04): Unraid 6.12.4
Apache or nginx version (eg, Apache 2.4.25): ???
PHP version (eg, 7.4): ???

The issue you are facing:

I have configured Nextcloud in Docker on my Unraid server. I’m able to access it from my LAN on the port I configured, 444. (Note: I’m accessing my home network through an OpenVPN connection) I’ve set up a Cloudflare tunnel, added the domain, and Cloudflare shows the connection has healthy.

However, when I try to access my Nextcloud from my custom domain Nextcloud.example.com, I get an " Access through untrusted domain" message suggesting:

“Please contact your administrator. If you are an administrator, edit the “trusted_domains” setting in config/config.php like the example in config.sample.php.”

So, I go to the terminal in Unraid, open Config.php, scroll down to trusted domains and add 1 => ‘Nextcloud.example.com

However, this has not solved the problem and I still get the error message.

I’m sure I’m just missing something obvious. Please let me know if there’s any additional info that’s needed to answer this and thanks for taking the time to help.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Add Cloudflare tunnel domain to config.php
  2. Attempt to log into Nextcloud via domain.
  3. Receive Nextcloud error message.

The output of your Nextcloud log in Admin > Logging:

No output in log.

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

  GNU nano 7.2                              
/mnt/user/appdata/nextcloud/config/config.php                                         
<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'ocdbo0uotijj',
  redacted*
  'trusted_domains' => 
  array ( 
   0 => '192.168.1.32:8666',
   1 => 'https://nextcloud.example.com',
   2 => 'nextcloud.example.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '27.1.4.1',
  'overwrite.cli.url' => 'http://192.168.1.32:8666',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.1.32:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
                                                        [ Read 46 lines ]
^G Help         ^O Write Out    ^W Where Is     ^K Cut          ^T Execute      ^C Location     M-U Undo        M-A Set Mark
^X Exit         ^R Read File    ^\ Replace      ^U Paste        ^J Justify      ^/ Go To Line   M-E Redo        M-6 Copy

Ask cloudflare support since the issue is with their service, and link back here. https://community.cloudflare.com/

Buenas tardes, añade al final del archivo config/config.php la línea
‘trusted_proxies’ => [‘IP-SERVIDOR-PROXY:PUERTO’],
);
Good Luck.!!!