Tried everything but redirect not working

Hi all

I am running docker swarm cluster and it is working fine, except certain things that are driving me nuts. My php-fpm app and nginx webserver reachable but when I try to login it takes more than two minutes and then times out. Not sure if its my app or traefik. However, when I check the url after the app timed out it does not redirect to https. Instead it reverts to http, and I think thats why it times out. I am posting my docker compose file below and hope someone can point out where I'm going wrong.

Thank you in advance

version: "3.9"

services:

  traefik:
    image: "traefik:v2.10.7"
    command:
      - --api
      - --providers.docker
      - --api.dashboard=true
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.docker.exposedbydefault=false
      - --providers.docker.swarmmode=true
      - --providers.docker.network=proxy
      - --entrypoints.web.http.redirections.entryPoint.to=websecure
      - --entrypoints.web.http.redirections.entryPoint.scheme=https
    # Letsencrypt
      - --log.level=DEBUG
      - --certificatesresolvers.leresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
      - --certificatesresolvers.leresolver.acme.email=mail@domain.com
      - --certificatesresolvers.leresolver.acme.storage=/letsencrypt/acme.json
      - --certificatesresolvers.leresolver.acme.tlschallenge=true
    networks:
      - proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "letsencrypt/:/letsencrypt/"
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.traefik.entrypoints=websecure"
        - "traefik.http.routers.traefik.rule=Host(`traefik.domain.com`)"
        - "traefik.http.routers.traefik.service=api@internal"
        - "traefik.http.services.traefik.loadbalancer.server.port=8080"
        - "traefik.http.routers.traefik.tls.certresolver=leresolver"
        - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
        - "traefik.http.routers.http-catchall.entrypoints=web"
        - "traefik.http.routers.traefik.middlewares=authtraefik"
        - "traefik.http.middlewares.authtraefik.basicauth.users=user:.....
      mode: global
      placement:
        constraints:
          - "node.role==manager"

 website:
    image: nginx:1.25.3-alpine
    networks:
      - proxy
    volumes:
      - ....
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.website.rule=Host(`domain.com`)"
        - "traefik.http.routers.website.tls.certresolver=leresolver"
        - "traefik.http.services.website.loadbalancer.server.port=80"
        - "traefik.http.routers.website.entrypoints=websecure"
      mode: replicated
      replicas: 1
      placement:
        max_replicas_per_node: 1
        constraints:
          - "node.role==worker"

networks:
  proxy:
    external: true

How do you run Traefik with LE in a Docker Swarm cluster?

Be aware that standard Traefik CE does not support clustered LE, running multiple Traefik instances.

Enable and check Traefik debug log and access log.

Check browsers developer tools network tab.