Traefik
Basic Auth
A guide to configure basic auth with Traefik in Coolify
The configuration is slightly different for Standard Applications
and Docker Compose
based applications/one-click services.
All you need to do is to set custom labels on your application.
Standard Applications
traefik.http.middlewares.custom-auth.basicauth.users=test:$2y$12$ci.4U63YX83CwkyUrjqxAucnmi2xXOIlEF6T/KdP9824f1Rf1iyNG
traefik.http.routers.<unique_router_name>.middlewares=custom-auth
In the example above, we are using test
as username and test
as password.
Docker Compose based Applications & one-click Services
You only need to add the basicauth middleware.
traefik.http.middlewares.custom-auth.basicauth.users=test:$2y$12$ci.4U63YX83CwkyUrjqxAucnmi2xXOIlEF6T/KdP9824f1Rf1iyNG
In the example above, we are using test
as username and test
as password.
How to generate user/password?
You need to set your username and password in the basicauth.users
label.
You can generate your password with an online htpasswd generator or htpasswd command:
htpasswd -nbB test test