No way to get dashboard to work in secure mode

Hello,
I am trying to understand how to make dashboard in secure mode with Docker Swarm work locally, but I can't get it to work. The documentation is not helpful at all in this case, as it sucks. This is my configuration:
Static config:

[log]
level = "INFO"

[accessLog]

[api]
dashboard = true

[entryPoints]
    [entryPoints.web]
    address = ":80"

    [entryPoints.websecure]
    address = ":443"

[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
swarmMode = true
swarmModeRefreshSeconds = 15
watch = true

[http.middlewares]
    [http.middlewares.basic-auth.basicAuth]
    usersFile = "/etc/httpd/.htpasswd"

and then in docker stack file:

proxy:
    image: traefik:v2.3
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.dashboard.rule=Host(`traefik.domain.tld`)" # This domain is defined locally in /etc/hosts
        - "traefik.http.routers.dashboard.middlewares=basic-auth"
        - "traefik.http.routers.dashboard.service=api@internal"
        - "traefik.http.routers.dashboard.entrypoints=web"
      placement:
        constraints:
          - "node.labels.role==master"
      restart_policy:
        condition: on-failure
        delay: 1s
        window: 10s
    networks:
      - public
    ports:
      - target: 80
        published: 80
        protocol: tcp
        mode: host
      - target: 443
        published: 443
        protocol: tcp
        mode: host
      - 8080:8080
    volumes:
      - ./config/traefik/traefik.toml:/etc/traefik/traefik.toml:ro
      - /etc/httpd/.htpasswd:/etc/httpd/.htpasswd:ro
      - /var/run/docker.sock:/var/run/docker.sock

I have no idea what is wrong here and I waster hours to get it to work with no result. Do I need to have SSL enabled for it to work? Is there a mistake in my configuration? I have no idea.
All I get is 404.

Thank you very much!

Hello,

The http.middlewares configuration is a part of the dynamic configuration.

The file traefik.toml contains the static configuration.

So you have to create a dedicated file to put the dynamic configuration and use the file provider.

Thank you, it works! Documentation can be very confusing sometimes and me trying to things the most efficient way (at least according to me) didn't help :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.