Dashboard with basic auth but can't login in anyway

Hi!

Guys I'm confused, here is my traefik compose, I trying to add secure to dashboard, but after I opened host, and type login with password but fields get refresh after every trying, what is grong with my config?

  traefik:
    image: traefik:latest
    container_name: traefik
    command:
      - --serverstransport.insecureskipverify=true
      - --log.level=DEBUG
      - --api.dashboard=true
      - --api.debug=true
      - --api.insecure=false
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --entrypoints.web.http.redirections.entryPoint.to=websecure
      - --entrypoints.traefik.address=:81
      - --certificatesresolvers.myresolver.acme.httpchallenge=true
      - --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
      - --certificatesresolvers.myresolver.acme.email=mail@my.host
      - --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
    environment:
      - TZ=Europe/Kiev
    ports:
      - 80:80
      - 82:81
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefik-le:/letsencrypt
    restart: unless-stopped
    extra_hosts:
      - host.docker.internal:172.17.0.1
    networks:
      - web
    labels:
      # Redirect HTTP traffic to HTTPS
      - traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.redirs.entrypoints=web
      - traefik.http.routers.redirs.middlewares=redirect-to-https
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
      # Dashboard
      - traefik.enable=true
      - traefik.http.routers.dashboard.rule=Host(`proxy.my.host`)
      - traefik.http.routers.dashboard.service=api@internal
      - traefik.http.services.dashboard.loadbalancer.server.port=81
      - traefik.http.routers.dashboard.entrypoints=websecure
      - traefik.http.routers.dashboard.tls=true
      - traefik.http.routers.dashboard.tls.certresolver=myresolver
      - traefik.http.routers.dashboard.middlewares=auth
      - traefik.http.middlewares.auth.basicauth.users=admin:qAzcDeGhNkl1

Screencast 2022-01-28 13_27_29

1 Like

My question was incorrect password generation. Here is the correct command for generating passwords in case with docker compose: echo $(htpasswd -nbB USER "PASS") | sed -e s/\\$/\\$\\$/g

Hope this indeed help for someone else. :+1:

1 Like

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