Traefik 无法访问 Dashboard

Traefik cannot access Dashboard

我对 Traefik 有疑问。我所有的服务都很好,Traefik 完成了他的工作,检索了 Lets Encrypt 的证书,在我的不同应用程序之间进行了负载平衡。

我的问题是我无法访问仪表板,它询问我 login/password,但我在 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

如果你有想法。谢谢

我找到了。我没有对我的密码进行编码。 我使用这个网站:https://www.web2generators.com/apache-tools/htpasswd-generator 对我的密码进行编码。

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

注意:哈希中的所有美元符号都需要加倍以进行转义