Traefik2 + Nextcloud = tons of errors

Hello, I'm trying to switch from nginx reverse proxy to traefik2 but I'm stuck with migrating my nextcloud.

Traefik docker compose:

networks:
  reverse_proxy_network:
    external: true
services:
  traefik:
    image: traefik:v2.10.4
    container_name: traefik
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - /home/ubuntu/docker/traefik/data/traefik.yml:/traefik.yml:ro
      - /home/ubuntu/docker/traefik/data/acme.json:/acme.json
      - /home/ubuntu/docker/traefik/config.yml:/config.yml:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
       - CF_DNS_API_TOKEN=token
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik.domain.pl`)"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik.domain.pl`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
      - "traefik.http.routers.traefik-secure.tls.domains[0].main=domain.pl"
      - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain.pl"
      - "traefik.http.routers.traefik-secure.service=api@internal"
    networks:
      - reverse_proxy_network
    restart: unless-stopped

Nextcloud docker compose:

networks:
  reverse_proxy_network:
    external: true
  mysql:
services:
  nextcloud:
    image: lscr.io/linuxserver/nextcloud:latest
    container_name: nextcloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Warsaw
    ports:
      - 8081:443
    volumes:
      - /ssd/nextcloud/appdata:/config
      - /ssd/nextcloud/data:/data
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=reverse_proxy_network"
      - "traefik.http.middlewares.nextcloud-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.nextcloud-secure.entrypoints=https"
      - "traefik.http.routers.nextcloud-secure.rule=Host(`nextcloud.domain.pl`)"
      - "traefik.http.routers.nextcloud-secure.service=nextcloud"
      - "traefik.http.routers.nextcloud-secure.tls=true"
      - "traefik.http.routers.nextcloud-secure.tls.certResolver=cloudflare"
#      - "traefik.http.routers.nextcloud.entrypoints=https"
#      - "traefik.http.routers.nextcloud.middlewares=nextcloud-https-redirect"
#      - "traefik.http.routers.nextcloud.rule=Host(`nextcloud.domain.pl`)"
      - "traefik.http.services.nextcloud.loadbalancer.server.port=80"
      - "traefik.http.services.nextcloud.loadbalancer.sticky.cookie=true"
    networks:
      - 'mysql'
      - 'reverse_proxy_network'

I exposed 8081 port to check if my nextcloud works properly, and it does.

Traefik config.yml

http:
 #region routers
  routers:
    nextcloud:
      entryPoints:
        - "https"
      rule: "Host(`nextcloud.domain.pl`)"
      middlewares:
#        - default-headers
        - nextcloud-secure-headers
        - https-redirectscheme
      tls:
        domains:
          - main: "nextcloud.domain.pl"
      service: nextcloud

#endregion
#region services
  services:
    nextcloud:
      loadBalancer:
        servers:
          - url: "https://local-ip"
        passHostHeader: true
#endregion
  middlewares:
    https-redirectscheme:
      redirectScheme:
        scheme: https
        permanent: true

    nextcloud-secure-headers:
      headers:
        hostsProxyHeaders:
          - "X-Forwarded-Host"
        referrerPolicy: "same-origin"
        customResponseHeaders:
          X-Robots-Tag: "none"


    default-whitelist:
      ipWhiteList:
        sourceRange:
        - "10.0.0.0/8"
        - "192.168.0.0/16"
        - "172.16.0.0/12"

    secured:
      chain:
        middlewares:
        - default-whitelist
        - default-headers

and traefik.yml

global:
  checkNewVersion: false
  sendAnonymousUsage: false
log:
 level: INFO
 format: common
api:
  dashboard: true
  insecure: true
entryPoints:
  http:
    address: :80
#    http:
#      redirections:
#        entryPoint:
#          to: https
#          scheme: https
  https:
    address: :443
certificatesResolvers:
  cloudflare:
    acme:
      email: "mail"
      storage: acme.json
      dnsChallenge:
        provider: cloudflare
        delayBeforeCheck: 30
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"
serversTransport:
  insecureSkipVerify: true
providers:
  docker:
    # -- (Optional) Enable this, if you want to expose all containers automatically
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
  file:
    filename: /config.yml
#    watch: true

Currently i got error: A timeout occurred
with does errors:

time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2024-02-10T17:22:50Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"

I tried to change loadbalancer port from 80 to 433, but it only produced other error. Any idea what should i change?

What do you want to achieve? It currently looks to me like you created the same dynamic config router via labels and in file.