I tried basic auth using docker-compose with just the labels and with grafana.
Just the labels:
labels:
# traefik.enable: true
# traefik.frontend.rule: "Host:traefik.kenjibailly.xyz"
# get md5 from htpasswd or http://www.htaccesstools.com/htpasswd-generator/
# and then double all $ to $$ to avoid docker-compose
- "traefik.http.middlewares.test-auth.basicauth.users=admin:$$apr1$$0QjLF.3T$$tfscnZS/gpLPH.aKD5lEV0"
- "traefik.http.middlewares.test-auth.basicauth.realm=traefik"
- "traefik.http.middlewares.my-auth.basicauth.headerField=admin"
- "traefik.http.middlewares.test-auth.basicauth.removeheader=true"
With grafana:
grafana:
image: grafana/grafana:6.6.0
labels:
traefik.enable: true
# HTTP (LAN) connection
traefik.http.routers.grafana_lan.rule: Host(`traefik.kenjibailly.xyz`) && PathPrefix(`/grafana`)
traefik.http.routers.grafana_lan.entrypoints: web
traefik.http.routers.grafana_lan.middlewares: grafana_auth,strip_grafana_prefix
# HTTPS (WAN) connection
# traefik.http.routers.grafana_wan.rule: Host(`wan.localhost`) && PathPrefix(`/grafana`)
# traefik.http.routers.grafana_wan.entrypoints: websecure
# traefik.http.routers.grafana_wan.tls: true
# traefik.http.routers.grafana_wan.middlewares: grafana_auth,strip_grafana_prefix
# Tell Traefik to use the port grafana to connect to `my-container`
traefik.http.services.grafana.loadbalancer.server.port: 3000
# middlewares
traefik.http.middlewares.grafana_auth.basicauth.users: admin:$$apr1$$0QjLF.3T$$tfscnZS/gpLPH.aKD5lEV0 # user/password
traefik.http.middlewares.grafana_auth.basicauth.removeheader: true
traefik.http.middlewares.strip_grafana_prefix.stripprefix.prefixes: /grafana
environment:
- GF_SERVER_ROOT_URL=http://traefik.kenjibailly.xyz/grafana
Both show up in the HTTP middleware as success with the hashed user:password.
But there's no pop up coming to login or use password, everyone can see the page.
How can I fix this?