Login fails on Subdomain but works on Domain

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Hello,

i have an Issue logging in to Nextcloud and i hope someone here can help me…

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 35.0.0.10
  • Operating system and version (e.g., Ubuntu 24.04):
    • Linux 6.12.107+deb13-amd64 x86_64
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.?
  • PHP version (e.g, 8.3):
    • 8.5
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • WebInstaller from nextcloud website (setup-nextcloud.php)
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • NO

Summary of the issue you are facing:

I end up with a Login-loop when i call Nextcloud from a Subdomain sub.domain.tld
When i use domain.tld everything works fine.
There seems to be an Issue with the Session files when using Subdomains.
The Browser (Chrome) Session is set correctly but as soon as i am redirected to /apps/dashboard a new Session is generated which leads back to the login page.

What is really strange for me is that when i leave the Tab with the login-page open for about 5-6 Minutes there is a good chance that the login works.

Log entries in nextcloud.log say “User not logged in”.

As soon i use a normal domain.tld everything works fine.
I am in contact with my hosting company (Hetzner.de) but they do not give nextcloud support when it is installed on normal Webhosting - which is understandable

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

  1. Use a Subdomain to open Nextcloud - try to login with a valid user (disable remember me - leads to “Too many redirects”)

  2. End up with a login loop

  3. If i wait for about 5-6 Minutes i sometimes (6 out of 10) can log in on a subdomain

    Login works everytime when logging in from a normal domain

CONFIG:

> $CONFIG = array (
>   'instanceid' => 'xxxxxxxxxxxx',
>   'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxx',
>   'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
>   'trusted_domains' => 
>   array (
>     0 => 'cloud.xxxxxx.at',
>     1 => 'www.xxxxxx.at',
>     2 => 'xxxxxx.at',
>   ),
>   'datadirectory' => '/usr/www/users/xxxxxx/cloudtest/data',
>   'dbtype' => 'pgsql',
>   'version' => '35.0.0.10',
>   'overwriteprotocol' => 'https',
>   'overwritehost' => 'cloud.xxxxxxx.at',
>   'overwrite.cli.url' => 'https://cloud.xxxxxxx.at',
>   'htaccess.RewriteBase' => '/',
>   'dbname' => 'xxxxxxxxxxx',
>   'dbhost' => 'xxxxxxxxxxxxxx',
>   'dbtableprefix' => 'oc\_',
>   'dbuser' => 'xxxxxxxxxxxxx',
>   'dbpassword' => 'xxxxxxxxxxxxxx',
>   'installed' => true,
>   'dbport' => 5432,
>   'loglevel' => 0,    
> );

LOG:

{"reqId":"arUrWxybgysYxhwiNBV7yAAAAAM","level":0,"time":"2026-09-24T13:53:31+00:00","user":"--","app":"dashboard","method":"GET","url":"/apps/dashboard/","message":"Current user is not logged in","exception":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401}}

{"reqId":"arUrWxybgysYxhwiNBV7ygAAAAM","level":1,"time":"2026-09-24T13:53:31+00:00","user":"--","app":"no app in context","method":"GET","url":"/login?redirect_url=/apps/dashboard/","message":"The app config key dav/hide_absence_settings is not defined in the config lexicon"}

{"reqId":"arUrjhybgysYxhwiNBV8hQAAABg","level":0,"time":"2026-09-24T13:54:22+00:00","user":"admin","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"dirty table reads: SELECT `name` FROM `*PREFIX*authtoken` WHERE (`uid` = :dcValue1) AND (`last_activity` >= :dcValue2)"}

EDIT: added more Information

Thank you in advance

Regards Markus

@markus_koller
hello and welcome to the beautiful world of the Nextcloud Community Forum.

Let me get that right. You used the webinstaller that Hetzner offers? or which webinstallier are you referring to?

Apart from that I would wish you would have filled in more details to our beloved support template.

Maybe it would even be helpful if you’d post your config.php (take care about all the sensitive data provided there)

@JimmyKater - sorry for not providing enough Information…
I used the setup Script that i downloaded from Nextcloud downloaden und installieren
I added the config.php Values and the nextcloud.log
There are no errors in PHP or anywhere else.

Thank you!

this is a new installation, right?

so you’ll find me quite surprised because the webinstaller usually works perfectly (though I can’t test it right now).

are there, by any chance, still unsolved setup messages under your admin account?

have you checked your apache-setup? or nginx? caddy?

See - why I was asking for using the support template? You cause more work to ppl trying to help by avoiding giving out more information about your setup and environment.

I need to ask openly: are you a kind of rookie in Linux? I mean - and I don’t want to sound impolite or insulting - do you know what to do and what needs to be done? Like a bare-metal installation of NC is no no-brainer, it needs to be maintained on a regular basis, etc. Just in case you’re a beginner maybe Nextcloud AIO would be the better choice for you?

I am a Linux-rookie you are right! But you already lead me to the (my) solution…

I don´t know how or why but i deleted the database and all the files in the folder, reinstalled Nextcloud using latest.zip (not setup-nextcloud.php) - everything is working fine.
I made no changes to my PHP-Settings or DB-Settings, used the same Folder and the same DB (deleted all Tables before).
I did not even empty the browser cache or delete any cookies.

So all can say is thank you for your time and effort!
If you prefer to delete the Topic - feel free to do it as it may not be useful to other members…

Sorry for the inconvenience!

Regards
Markus