Properly handling custom port in nextcloud url with docker and nginx-proxy

Nextcloud version: Nextcloud Hub 7 (28.0.2)
Operating system and version : Ubuntu 20.04.6 LTS
Apache or nginx version : jwilder/nginx-proxy
PHP version: 8.2.16

The issue you are facing:
After last update to version 28 I have problem with my Nextcloud instance. I get access to Nextcloud through url: nextcloud.domain.com:10000. I can’t do this with default 443 or 80 port. Earlier everything works fine, but after last update I have problem with redirections and access through apps.

Is this the first time you’ve seen this error?
After update to version 28.

Steps to replicate it:
On android app, it found Nextcloud server through url, but I can’t log in. I provide passes and stuck on logging in.

On browser, I can’t go to page nextcloud.domain.com:10000. It automatically redirects me to nextcloud.domain.com/login. I can go to nextcloud.domain.com:10000/apps/files/ and then I get login page. I can log in, but again I need to go manually to nextcloud.domain.com:10000/apps/files/ because I don’t have redirection after login (looks similar to mobile app).

How should I config it properly?

My config:

<?php
$CONFIG = array (
  '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' => 'xxxx',
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.domain.com:10000',
    1 => 'nextcloud.domain.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '28.0.2.5',
  'overwrite.cli.url' => 'http://nextcloud.domain.com:10000',
  'dbname' => 'nextcloud',
  'dbhost' => 'mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'overwriteprotocol' => 'https',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_domain' => 'domain.com',
  'mail_smtphost' => 'mail0.domain.pl',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'nextcloud@domain.com',
  'mail_smtppassword' => 'xxxx',
  'maintenance' => false,
  'loglevel' => 0,
  'theme' => '',
  'logtimezone' => 'Europe/Warsaw',
  'default_phone_region' => 'PL',
  'memories.exiftool' => '/var/www/html/custom_apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/html/custom_apps/memories/bin-ext/go-vod-amd64',
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Image',
    1 => 'OC\\Preview\\HEIC',
    2 => 'OC\\Preview\\TIFF',
    3 => 'OC\\Preview\\Movie',
  ),
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
);

docker-compose:

version: '3' 

services:

  proxy:
    image: jwilder/nginx-proxy
    container_name: nextcloud-proxy
    hostname: nextcloud-proxy
    networks:
      - nextcloud-network
    ports:
      - "10000:443"
    restart: unless-stopped
    volumes:
      - /root/nextcloud/nextcloud-proxy/certs:/etc/nginx/certs
      - /root/nextcloud/nextcloud-proxy/conf.d/upload.conf:/etc/nginx/conf.d/upload.conf
      - /var/run/docker.sock:/tmp/docker.sock:ro

  mariadb:
    image: mariadb
    container_name: nextcloud-mariadb
    command: --transaction-isolation=READ-COMMITTED --log-bin=ROW --innodb-read-only-compressed=OFF
    hostname: nextcloud-mariadb
    networks:
      - nextcloud-network
    volumes:
      - /root/nextcloud/nextcloud-mariadb:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=xxxx
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped
    ports:
      - "127.0.0.1:3306:3306"
  
  server:
    image: nextcloud:28.0.2
    container_name: nextcloud-server
    hostname: nextcloud-server
    networks:
      - nextcloud-network
    depends_on:
      - mariadb
      - proxy
    volumes:
      - /root/nextcloud/nextcloud-server/html:/var/www/html
      - /root/nextcloud/nextcloud-server/config:/var/www/html/config
      - /root/nextcloud/nextcloud-server/custom_apps:/var/www/html/custom_apps
      - /media/raid2/nextcloud:/var/www/html/data
      - /root/nextcloud/nextcloud-server/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - VIRTUAL_HOST=nextcloud.domain.com
      - OVERWRITEPROTOCOL=https
    restart: unless-stopped

networks:
  nextcloud-network:

Really nobody use config like that?