Traefik API config example using Wildcard certificates and HTTP username/password (basic auth)

Based on our previous post Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges this is the TOML config I use to allow access to the Traefik dashboard using HTTPS and my Let’s encrypt wildcard certificate. In this example, it will be reachable under Place the config in /opt/traefik/conf/api.toml assuming you have setup Traefik based on our example.

rule = "Host(``)"
service = "[email protected]"
middlewares = ["auth"]
certresolver = "cloudflare"
main = ""
sans = ["*"]

users = [

Create a new password string using htpasswd:

htpasswd -n admin

When prompted, enter the password and then copy the password such as admin:$apr1$ocvmQb0w$Bwlbz3V2VVRZlcu46X0zK0 to the [http.middlewares.auth.basicAuth] section:

users = [

It should look like our full example above.