Login loop after updating dockerized nextcloud to version 19

I am running the official nextcloud docker container on a Debian Buster host behind nginx as reverse proxy.
Since upgrading to nextcloud version 19.0.1 I am stuck with a login loop: After entering my data, I simply get redirected to login?redirect_url=/apps/files/ and I am required to login again.
This behavior occurs independently from whether I enter correct or incorrect data.
The behavior persists after re-starting the container with completely clean volumes (i.e. a clean database, a clean config, …).

I do not see any error message (even though debug is set to true).
The nextcloud server log does not contain any warnings.
If I set loglevel to 0 (DEBUG), I see various messages that do not appear to have anything to with the login attempt.

I have read that this bug can occur if the reverse proxy is not set up correctly.
However, I think that I have set it up as described in the manual and the setup worked before the update to version 19.

Here is (an anonymized version of) my config.php

<?php
$CONFIG = array (
  'debug' => true,
  '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,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'redis',
    'password' => '',
    'port' => 6379,
  ),
  'instanceid' => '<SomeID>',
  'passwordsalt' => '<SomeSalt>',
  'secret' => '<SomeSecret>',
  'trusted_domains' => 
  array (
    0 => 'cloud.<MyDomain>',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '19.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '<SomePassword>',
  'installed' => true,
  'maintenance' => false,
  'trusted_proxies' => 
  array (
    0 => '<ThePublicIPOfTheHostServer>',
  ),
  'overwriteprotocol' => 'https',
  'overwritehost' => 'cloud.<MyDomain>',
  'overwitewebroot' => '/',
  'overwritecondaddr' => '^<Parts>\.<Of>\.<My>\.<IPAdress>$',
  'overwrite.cli.url' => 'https://cloud.<MyDomain>',
  'logtimezone' => 'Europe/Berlin',
  'logdateformat' => 'Y-m-d H:i:s',
  'loglevel' => 0,
  'log_type' => 'file',
  'logfile' => 'nextcloud.log',
  'theme' => '',
);

Any help would be greatly appreciated!

The bug has disappeared after disasbling redis.

I had an issue with this when my APCu cache had bad permissions in my file system. You may want to switch to a different cache or check your cache’s permissions based on its documentation.

It seems that there are no problems with the cache permission.

I tried locating the problem some more and found out the following:

When I set Redis and APCu by hand in config.php, it works.

  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => [
    'host' => 'redis',
    'port' => 6379,
  ],

When I set REDIS in my docker-compose.yml file, I get the login loop as described above

    environment:
        - TZ=Europe/Berlin
        - REDIS_HOST=redis
        - REDIS_HOST_PASSWORD=

Actually, redis.config.php should read out the environment variables and use the exact same config options:

<?php
if (getenv('REDIS_HOST')) {
  $CONFIG = array (
    'memcache.distributed' => '\OC\Memcache\Redis',
    'memcache.locking' => '\OC\Memcache\Redis',
    'redis' => array(
        'host' => getenv('REDIS_HOST'),
        'password' => getenv('REDIS_HOST_PASSWORD'),
    ),
  );

  if (getenv('REDIS_HOST_PORT') !== false) {
    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
  } elseif (getenv('REDIS_HOST')[0] != '/') {
    $CONFIG['redis']['port'] = 6379;
  }
}