Internal Server Error with reverse proxy (haproxy) and nginx

nextcloud_haproxy

Nextcloud version _: 23
Operating system and version (eg, Ubuntu 20.04): ArchLinux Mainline Kernel
Apache or nginx version (eg, Apache 2.4.25): nginx
PHP version (eg, 7.4): php 8.3.1

cat config.php
<?php
$CONFIG = array (
  'trusted_proxies'   => '192.168.1.1',
  'overwritehost'     => 'cloud.XXX.ch',
  'overwriteprotocol' => 'http',
  'overwritewebroot'  => '/',
  'overwritecondaddr' => '^192\.168\.1\.1$',
  'datadirectory' => '/home/data/nextcloud',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/share/webapps/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
    1 => 
    array (
      'path' => '/var/lib/nextcloud/apps',
      'url' => '/wapps',
      'writable' => true,
    ),
  ),
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' => 
  array (
	  0 => 'localhost',
	  1 => 'cloud.xxx.ch',
	  2 => 'External IP',
	  3 => '192.168.1.118',
	  4 => '192.168.1.1',
  ),
  'dbtype' => 'mysql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://cloud.xxx.ch',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin2',
  'dbpassword' => 'XXXX',
  'installed' => true,
  'instanceid' => 'XXX',
);

nginx access log looks good

192.168.1.1 - - [20/Feb/2022:10:17:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:10:32:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "OPTIONS /remote.php/dav/principals/users/admin/ HTTP/1.1" 502 157 "-" "iOS/15.3.1 (19D52) dataaccessd/1.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "OPTIONS /remote.php/dav/principals/users/admin/ HTTP/1.1" 502 157 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "PROPFIND /remote.php/dav/principals/users/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "PROPFIND /remote.php/dav/principals/users/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) dataaccessd/1.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "PROPFIND /remote.php/dav/principals/users/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) dataaccessd/1.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "PROPFIND /remote.php/dav/calendars/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:10:46:35 +0000] "OPTIONS /remote.php/dav/principals/users/admin/ HTTP/1.1" 502 157 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:10:47:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:11:02:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:11:17:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:11:32:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:11:47:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:11:59:12 +0000] "OPTIONS /remote.php/dav/principals/users/admin/ HTTP/1.1" 502 157 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:11:59:12 +0000] "PROPFIND /remote.php/dav/principals/users/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:11:59:12 +0000] "PROPFIND /remote.php/dav/calendars/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:11:59:12 +0000] "OPTIONS /remote.php/dav/principals/users/admin/ HTTP/1.1" 502 157 "-" "iOS/15.3.1 (19D52) remindd/1.0"
192.168.1.1 - - [20/Feb/2022:11:59:14 +0000] "OPTIONS /remote.php/dav/principals/users/admin/ HTTP/1.1" 502 157 "-" "iOS/15.3.1 (19D52) dataaccessd/1.0"
192.168.1.1 - - [20/Feb/2022:11:59:15 +0000] "PROPFIND /remote.php/dav/principals/users/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) dataaccessd/1.0"
192.168.1.1 - - [20/Feb/2022:11:59:15 +0000] "PROPFIND /remote.php/dav/principals/users/admin/ HTTP/1.1" 200 31 "-" "iOS/15.3.1 (19D52) dataaccessd/1.0"
192.168.1.1 - - [20/Feb/2022:12:02:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:12:17:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:12:32:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
192.168.1.1 - - [20/Feb/2022:12:47:06 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 2520 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"

No error since 01-31-2022

cat nextcloud.log 

https://termbin.com/qr69

What colud be the error?
Have I to adjust the config.php ?

@Kerasit Have you a input?

Or anybody else?