User not logged in NC 22.0.2

Nextcloud version (eg, 20.0.5): 22.2.0.2
Operating system and version (eg, Ubuntu 20.04): debian bullseye in docker
Apache or nginx version (eg, Apache 2.4.25): Nginx Proxy Manager Version 2.9.11 (3b47dec) in docker, OpenResty 1.19.3.1, debian 10 (buster), Certbot certbot 1.20.0

PHP version (eg, 7.4): 8.0.12

The issue you are facing:

We see that sometimes a login is not possible. Also we see that the user will logout and can’t login after. We see that the problem seems to be more present on Safari on iOS and MacOS. It seems that nextcloud think the user is not logged in.

Is this the first time you’ve seen this error? (Y/N):
N
Steps to replicate it:

  1. Login at different times

The output of your Nextcloud log in Admin > Logging:

{"reqId":"idN7FgpyRPBKtvLry1Z6","level":0,"time":"2021-11-07T03:14:52+00:00","remoteAddr":"91.38.107.247","user":"--","app":"no app in context","method":"GET","url":"/apps/deck/","message":"Current user is not logged in","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1","version":"22.2.0.2","exception":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":97,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\Security\\SecurityMiddleware","type":"->","args":[{"__class__":"OCA\\Deck\\Controller\\PageController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[{"__class__":"OCA\\Deck\\Controller\\PageController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Deck\\Controller\\PageController"},"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":301,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Deck\\Controller\\PageController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"deck.page.index"}]},{"file":"/var/www/html/lib/base.php","line":1000,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/deck/"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php","Line":141,"CustomMessage":"Current user is not logged in"}}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'default_language' => 'de',
  'default_locale' => 'de_DE',
  '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' => 'ocskras0jp2m',
  'passwordsalt' => 'YsJfiga48j/PDu5+FF9uUfz0ebsLFd',
  'secret' => 'zyP9tAgdzx10/b+nZ9nXoHqi3q8FRkejCYI/Vn2U3NfQ3Blq',
  'trusted_domains' => 
  array (
    0 => 'cloud-theurer-endodontie.de',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '22.2.0.2',
  'overwrite.cli.url' => 'https://xxx.de',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'xxx.de',
  'dbname' => 'xxx',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'xxx',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => 'xxx',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'app_install_overwrite' => 
  array (
    0 => 'files_fulltextsearch_tesseract',
    1 => 'dicomviewer',
    2 => 'whiteboard',
    3 => 'sharerenamer',
    4 => 'ocr',
    5 => 'flowupload',
    6 => 'cookbook',
  ),
  'maintenance' => false,
  'loglevel' => 0,
  'theme' => '',
);

The output of your Apache/nginx/system log in /var/log/____:

[07/Nov/2021:03:14:50 +0000] - 200 200 - POST https cloud-theurer-endodontie.de "/apps/mail/api/mailboxes/24/sync" [Client 165.225.27.78] [Length 984] [Gzip -] [Sent-to nextcloud] "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0" "-"
[07/Nov/2021:03:14:52 +0000] - 303 303 - POST https cloud-theurer-endodontie.de "/login" [Client 91.38.107.247] [Length 0] [Gzip -] [Sent-to nextcloud] "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1" "-"
[07/Nov/2021:03:14:52 +0000] - 303 303 - GET https cloud-theurer-endodontie.de "/apps/deck/" [Client 91.38.107.247] [Length 0] [Gzip -] [Sent-to nextcloud] "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1" "-"
[07/Nov/2021:03:14:53 +0000] - 200 200 - GET https cloud-theurer-endodontie.de "/login?redirect_url=/apps/deck/" [Client 91.38.107.247] [Length 5253] [Gzip -] [Sent-to nextcloud] "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1" "-"

Did you ever end up resolving this issue?