Can not log in in browser/desktop app, Android app and share-links work fine

Nextcloud version (eg, 20.0.5): 25.0.1
Operating system and version (eg, Ubuntu 20.04): Alpine Linux 3.12
Apache or nginx version (eg, Apache 2.4.25): nginx-1.22.1
PHP version (eg, 7.4): php8-8.0.25

The issue you are facing:

The login page opens fine in the browser, but after entering my credentials and clicking log in, I am ether greeted by a nginx 502 or back at the login page. Tried with multiple browsers, private mode, inside and outside of my network.

The Windows Client does not work either, the Android phone app works fine and has full access to all files, can up- and download.

Share links work as well, they can be viewed and the files downloaded/opened. Just the log-in itself is broken. I have yet to confirm if this is the case for all users or just me.

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

Steps to replicate it:

  1. Go to login page
  2. Try to log in
  3. Errors occur

Logs:

The output of your Nextcloud log in Admin > Logging:

No access to the web GUI, can’t get logs

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

$CONFIG = array (
  'instanceid' => 'something',
  'passwordsalt' => 'something',
  'secret' => 'something',
  'trusted_domains' =>
  array (
    0 => 'revproxy IP',
    1 => 'cloud.mydomain.tld',
  ),
  'datadirectory' => '/opt/nextcloud',
  'dbtype' => 'mysql',
  'version' => '25.0.1.1',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://cloud.mydomain.tld',
  'overwritehost' => 'cloud.mydomain.tld',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'something',
  'dbpassword' => 'something',
  'installed' => true,
  'default_language' => 'en',
  'default_locale' => 'de_DE',
  'default_phone_region' => 'IT',
  'mail_from_address' => 'something',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'something',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'something',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'something',
  'mail_smtppassword' => 'something',
  'mail_smtpsecure' => 'ssl',
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'theme' => '',
  'loglevel' => 3,
);

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

2022/11/30 15:14:48 [error] 1015#1015: *200 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: <revproxy IP>, server: cloud.mydomain.tld, request: "GET /status.php HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "cloud.mydomain.tld"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"taqdwPkhtJ9c71B8D7TZ","level":3,"time":"2022-11-30T13:27:17+00:00","remoteAddr":"<revproxy IP>","user":"--","app":"core","method":"GET","url":"/login?redirect_url=/apps/dashboard/","message":"Tried to log in <username> but could not verify token","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0","version":"25.0.1.1","data":{"app":"core"}}
{"reqId":"tVQLsa2Ou9rEAxTwuYrw","level":3,"time":"2022-11-30T13:27:17+00:00","remoteAddr":"<revproxy IP>","user":"--","app":"core","method":"GET","url":"/apps/theming/image/background?v=5","message":"Tried to log in <username> but could not verify token","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0","version":"25.0.1.1","data":{"app":"core"}}
{"reqId":"NyxN86ShroySP7GfxgHU","level":3,"time":"2022-11-30T13:27:17+00:00","remoteAddr":"<revproxy IP>","user":"--","app":"core","method":"GET","url":"/apps/theming/image/background?v=5","message":"Tried to log in <username> but could not verify token","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0","version":"25.0.1.1","data":{"app":"core"}}
{"reqId":"v027gFPgHeousxNeZbTz","level":3,"time":"2022-11-30T13:31:35+00:00","remoteAddr":"<revproxy IP>","user":"--","app":"core","method":"GET","url":"/apps/theming/image/background?v=5","message":"Tried to log in <username> but could not verify token","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0","version":"25.0.1.1","data":{"app":"core"}}

EDIT: I was on 24.something when the error occured, tried disabling some apps to maybe narrow it down (among them theming, theme background never showed up again even after re-enabling it). I then updated to the latest stable manually, thinking that would maybe fix my issues. It did not - issues remained exactly the same on the new version.