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, 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 => ‘

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                              
$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',
  'trusted_domains' => 
  array ( 
   0 => '',
   1 => '',
   2 => '',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'dbname' => 'nextcloud',
  'dbhost' => '',
  '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.

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