NextCloud refusing log in from a domain it should accept

Hello all!

I have a local network with a mesh 192.168.68.1/24 cabled to a modem 192.168.15.1/24, and a homeserver based on TrueNAS Scale 24.10, Tailscale, NPM, and NextCloud on ip 192.168.68.68 named ada. No SSL involved for this while.

I got Tailscale properly config’d for no HTTPS, so I can properly access both through 192.168.68.68, ada and ada.alpha-centauri.ts.net almost everything: webadmin on :80, nginx admin on :30020, NextCloud on :30027 and even my weird subversion setup on :3690.

Except for one thing: NextCloud won’t accept login through ada.alpha-centauri.ts.net. It won’t give “not trusted domain” messages or else. It will just :arrows_counterclockwise: for half second and I’ll be still on the login page. If I login through 192.168.68.68, tailscale’s ip, ada, it will work perfectly.

NextCloud docker log for the event is this:

2025-03-09 16:34:20.658522+00:00172.16.2.1 - - [09/Mar/2025:16:34:20 +0000] "POST /login HTTP/1.1" 303 1910 "http://ada.iguana-centauri.ts.net:30027/login?direct=1&user=dandrea" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0"
2025-03-09 16:34:20.658522+00:00172.16.2.1 - - [09/Mar/2025:16:34:20 +0000] "POST /login HTTP/1.1" 303 1910 "http://ada.alpha-centauri.ts.net:30027/login?direct=1&user=dandrea" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0"
2025-03-09 16:34:20.720773+00:00172.16.2.1 - - [09/Mar/2025:16:34:20 +0000] "GET /login?direct=1&user=dandrea HTTP/1.1" 200 8488 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0"
2025-03-09 16:34:21.530861+00:00127.0.0.1 - - [09/Mar/2025:16:34:21 +0000] "GET /status.php HTTP/1.1" 200 1068 "-" "curl/7.88.1"

Relevant info on ./config/config.php (I erased some critical lines):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'overwrite.cli.url' => 'http://ada.alpha-centauri.ts.net/nextcloud',
  'preview_imaginary_url' => 'http://imaginary:9000',
  'overwriteprotocol' => 'http',
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '192.168.68.68',
    2 => '192.168.0.0/16',
    3 => '172.16.0.0/12',
    4 => '10.0.0.0/8',
  ),
  'trusted_domains' =>
  array (
    0 => '127.0.0.1',
    1 => '192.168.68.68',
    2 => 'ada',
    3 => 'ada.alpha-centauri.ts.net',
    4 => 'ada.local',
    5 => 'localhost',
    6 => 'nextcloud',
  ),
);

I got no idea on how to debug this. Any clues?

Please check the relevant browser console tabs as suggested in the support template.’

Also use occ config:list system to make sure you’re viewing the real merged configuration (also noted in the support template).