Search code examples
traefik

Traefik cannot access Dashboard


I have a problem with Traefik. All my services are OK, Traefik does his job, retrieves the certificates of Lets Encrypt, makes Load blancing between my different applications.

My problem is that I can't access the Dashboard, it asks me a login/password, yet I informed it in the docker-compose.

version: "3.7"
services:

  traefik:
     image: traefik:chevrotin
     command:
       --entrypoints.http.address=:80
       --entrypoints.https.address=:443
       --providers.docker=true
       --api=true
       --certificatesresolvers.letsencrypt.acme.httpchallenge=true
       --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http
       --certificatesresolvers.letsencrypt.acme.email=mymail@mail.com
       --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
     labels:
       - traefik.enable=true
       # Redirect all HTTP traffic to HTTPS
       - traefik.http.routers.to-https.rule=Host(`traefik.mydomain.com`)
       - traefik.http.routers.to-https.entrypoints=http
       - traefik.http.routers.to-https.middlewares=to-https
       
       - traefik.http.routers.traefik.rule=Host(`traefik.mydomain.com`)
       - traefik.http.routers.traefik.entrypoints=http
       - traefik.http.routers.traefik.middlewares=auth
       - traefik.http.routers.traefik.service=api@internal
       - traefik.http.routers.traefik.tls=true
       - traefik.http.routers.traefik.tls.certresolver=letsencrypt
       
       - traefik.http.middlewares.to-https.redirectscheme.scheme=https
       
       - traefik.http.middlewares.auth.basicauth.users=MyLogin:MyPassword
     ports:
       - 80:80
       - 443:443
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock:ro
       - /docker/letsencrypt:/letsencrypt

if you have a idea. Thanks


Solution

  • I find. I'm not encoded my password. I use this website : https://www.web2generators.com/apache-tools/htpasswd-generator to encoded my password.

    • "traefik.http.middlewares.test-auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj

    Note: all dollar signs in the hash need to be doubled for escaping