Nextcloud wants to use IP and not domain

Hello all/Tom,

I recently deployed Nextcloud inside TrueNAS Scale following your most recent setup video. Thank you for that, BTW! Nextcloud, in general, seems to be working like it should, besides that Nextcloud wanting to use the local IP of my TrueNAS box and not the domain name.

I have a Cloudflare tunnel setup and by going to the Nextcloud’s subdomain, I can access Nextcloud without issues. It comes down to when I want to connect my Nextcloud client. You know, when you go to authenticate the agent, and it opens a webpage to complete the setup. Instead of it redirecting to the domain name, it redirects to the local IP. No matter what I put in the config.php file, I can’t seem to get it to use the domain. Also, when I go to Administration Settings → System → External monitoring tool it has the local IP and not the domain name like I think it should.

I would greatly appreciate any ideas on how to resolve this. Thanks!

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,
    ),
  ),
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '10.0.1.99', <-- Local Cloudflare Tunnel VM IP
  ),
  'passwordsalt' => '** REDACTED **',
  'secret' => '** REDACTED **',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '10.0.1.10:9001', <-- LOCAL TrueNAS IP
    2 => 'files.mydomain.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'pgsql',
  'version' => '27.0.1.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-postgres:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin',
  'dbpassword' => '**REDACTED**',
  'installed' => true,
  'instanceid' => '**REDACTED** ',
  'overwrite.cli.url' => 'https://files.mydomain.com',
  'overwritehost' => 'files.mydomain.com',
  'overwriteprotocol' => 'https',
  'default_phone_region' => 'US',
);

Administration Settings → System → External monitoring tool

2023-07-26 15_55_22-Nextcloud — Mozilla Firefox

This is what shows when I try to auth my Windows client.

I have never set that up on a TrueNAS scale system, might want to post in the IXSystems forums as well.

I’m sorry I didn’t clarify. My cloudflare tunnel is actually set up on my Proxmox host. But it’s no different than running reverse proxy via nginx. The problem I’m seeing is that Nextcloud doesn’t seem to be obeying the overwritehost in the configuration file. Or I think it’s overwritehost…

I am saying that I have not setup Nextcloud on TrueNAS to use the overwite host feature to get it pointed properly. There may be a setting that is being overridden via the TrueNAS setup which is why it ignores what’s in the config.php