Users are being logged out over and over

Hi,
I am facing issues with nextcloud for a Long time now. I mainly use nextcloud for the wider Family, so I have 5 Clients with at average let’s say 150GB storage.

So since a Long time (unfortunately I cannot tell when it started), all of the users are being logged out from time to time.
On the Desktop Client this means that the Icon in the tray turns Grey and the user has to log in again.
In the last time I am also logged out of my Android app from time to time.

I am Hosting nextcloud via the public docker Image. Previously I had a manually configured nginx as reverseproxy, however I already switched to the nginx-proxy docker Image as described on the official documentation but without success.

Here are two log excerpts that may cause the issue, unfortunately I have no clue how to fix it. Maybe someone of you has an idea?

I’m absolutely sure it’s not because of a bad Password, because 1. I never type my Password wrong :slight_smile: And 2. it happens at all Clients and I don’t expect all of them re-entering their Password wrong all the time.

{
  "reqId": "ckgUgfTYFz2NEj2Zohwh",
  "level": 2,
  "time": "2020-09-14T11:20:31+00:00",
  "remoteAddr": "91.42.27.204",
  "user": "peez",
  "app": "core",
  "method": "GET",
  "url": "/ocs/v2.php/core/navigation/apps?absolute=true&format=json",
  "message": "Login failed: 'peez' (Remote IP: '91.42.27.204')",
  "userAgent": "Mozilla/5.0 (Windows) mirall/3.0.1stable-Win64 (build 20200828) (Nextcloud)",
  "version": "19.0.3.1"
}

Second one:

{
  "reqId": "NDeXKxMkhFxp5NjqX9zV",
  "level": 0,
  "time": "2020-09-14T11:20:41+00:00",
  "remoteAddr": "91.42.27.204",
  "user": "--",
  "app": "webdav",
  "method": "PROPFIND",
  "url": "/remote.php/dav/files/peez/Eigene%20Dateien/Pictures",
  "message": {
	"Exception": "Sabre\\DAV\\Exception\\NotAuthenticated",
	"Message": "No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured",
	"Code": 0,
	"Trace": [
	  {
		"file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
		"line": 89,
		"function": "beforeMethod",
		"class": "Sabre\\DAV\\Auth\\Plugin",
		"type": "->",
		"args": [
		  {
			"__class__": "Sabre\\HTTP\\Request"
		  },
		  {
			"__class__": "Sabre\\HTTP\\Response"
		  }
		]
	  },
	  {
		"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
		"line": 458,
		"function": "emit",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": [
		  "beforeMethod:PROPFIND",
		  [
			{
			  "__class__": "Sabre\\HTTP\\Request"
			},
			{
			  "__class__": "Sabre\\HTTP\\Response"
			}
		  ]
		]
	  },
	  {
		"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
		"line": 251,
		"function": "invokeMethod",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": [
		  {
			"__class__": "Sabre\\HTTP\\Request"
		  },
		  {
			"__class__": "Sabre\\HTTP\\Response"
		  }
		]
	  },
	  {
		"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
		"line": 319,
		"function": "start",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": []
	  },
	  {
		"file": "/var/www/html/apps/dav/lib/Server.php",
		"line": 320,
		"function": "exec",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": []
	  },
	  {
		"file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
		"line": 35,
		"function": "exec",
		"class": "OCA\\DAV\\Server",
		"type": "->",
		"args": []
	  },
	  {
		"file": "/var/www/html/remote.php",
		"line": 167,
		"args": [
		  "/var/www/html/apps/dav/appinfo/v2/remote.php"
		],
		"function": "require_once"
	  }
	],
	"File": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Auth/Plugin.php",
	"Line": 161,
	"CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (Windows) mirall/3.0.1stable-Win64 (build 20200828) (Nextcloud)",
  "version": "19.0.3.1"
}

You can find in this documentation some settings. Have you modified them? Perhaps you can post your modification to a standard config/config.php
https://docs.nextcloud.com/server/19/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=cookie#user-experience

Nextcloud clients are usually using Cookies to store information about successful logins.You should make sure that these cookies are not automatically deleted when you
e.g. exit a browser or if you use cookie blocker addons etc.

Thanks for that link, I’m gonna try something with session- or cookie timeout, however I don’t expect much effect here, as the default is something like 15 days and the desktop client is being logged out every 20 minutes at bad days.

Here my config.php:

<?php
$CONFIG = array (
  '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' => 'XXXXXX',
  'passwordsalt' => 'XXXXXX',
  'secret' => 'XXXXXX',
  'trusted_domains' => 
  array (
	0 => 'freundx:44810',
	1 => 'nextcloud.mydomain.de',
	2 => 'freundx-nextcloud',
  ),
  'datadirectory' => '/var/www/html/data',
  'overwrite.cli.url' => 'https://nextcloud.mydomain.de',
  'overwritehost' => 'nextcloud.mydomain.de',
  'overwriteprotocol' => 'https',
  'dbtype' => 'pgsql',
  'version' => '19.0.3.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'freundx-nextcloud-postgres:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XXXXX',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'mydomain.de',
  'mail_smtphost' => 'smtp.sendgrid.net',
  'mail_smtpport' => '587',
  'maintenance' => false,
  'loglevel' => 0,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'theme' => '',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_sendmailmode' => 'smtp',
  'mail_smtpname' => 'apikey',
  'mail_smtppassword' => 'XXXXX',
  'filelocking.enabled' => true,
);

Here a screenshot from desktop client. It syncs perfectly until suddenly the server asks for login:
2020-09-16 09_29_38-Greenshot Editor

I double checked the logs - there is noting more than this Bearer Header error message:

{
  "reqId": "ADJtSOvUEvbTsstcFkfd",
  "level": 0,
  "time": "2020-09-16T07:21:19+00:00",
  "remoteAddr": "217.87.116.221",
  "user": "--",
  "app": "webdav",
  "method": "GET",
  "url": "/remote.php/dav/files/peez/Eigene%20Dateien/Pictures/2020/04/2020-04-10_15-49-32_20200410_154931.jpg",
  "message": {
	"Exception": "Sabre\\DAV\\Exception\\NotAuthenticated",
	"Message": "No public access to this resource., Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured, Username or password was incorrect",
	"Code": 0,
	"Trace": [
	  {
		"file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
		"line": 89,
		"function": "beforeMethod",
		"class": "Sabre\\DAV\\Auth\\Plugin",
		"type": "->",
		"args": [
		  {
			"__class__": "Sabre\\HTTP\\Request"
		  },
		  {
			"__class__": "Sabre\\HTTP\\Response"
		  }
		]
	  },
	  {
		"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
		"line": 458,
		"function": "emit",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": [
		  "beforeMethod:GET",
		  [
			{
			  "__class__": "Sabre\\HTTP\\Request"
			},
			{
			  "__class__": "Sabre\\HTTP\\Response"
			}
		  ]
		]
	  },
	  {
		"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
		"line": 251,
		"function": "invokeMethod",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": [
		  {
			"__class__": "Sabre\\HTTP\\Request"
		  },
		  {
			"__class__": "Sabre\\HTTP\\Response"
		  }
		]
	  },
	  {
		"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
		"line": 319,
		"function": "start",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": []
	  },
	  {
		"file": "/var/www/html/apps/dav/lib/Server.php",
		"line": 320,
		"function": "exec",
		"class": "Sabre\\DAV\\Server",
		"type": "->",
		"args": []
	  },
	  {
		"file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
		"line": 35,
		"function": "exec",
		"class": "OCA\\DAV\\Server",
		"type": "->",
		"args": []
	  },
	  {
		"file": "/var/www/html/remote.php",
		"line": 167,
		"args": [
		  "/var/www/html/apps/dav/appinfo/v2/remote.php"
		],
		"function": "require_once"
	  }
	],
	"File": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Auth/Plugin.php",
	"Line": 161,
	"CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (Windows) mirall/3.0.1stable-Win64 (build 20200828) (Nextcloud)",
  "version": "19.0.3.1"
}

Which web browser are you primarily using on your PC where the problem happens?

It’s different. Locally it’s chrome, but it also happened with Firefox or edge as standard browser.
With all other clients I don’t really know, but I think 50:50 edge or Firefox.

But as I said - I don’t expect it to be a client issue, because it happens with all clients that are using my nextcloud instance.

If the time is less than 60 minutes test a test account at https://try.nextcloud.com . If there are the same problems than it is a client or network problem. If not it is a server problem.

Also you can register free accounts e.g. at https://nc.nl.tab.digital . You only need an email-address and you can delete the account in the nextcloud-gui directly.

Thanks for the tips, but as I said I am sure that it’s not a client issue, because it happens on all of the clients - Windows, Android, iPhone, Mac.