Documentation Index
Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt
Use this file to discover all available pages before exploring further.
Authentication Middleware
Restricting Access to Your Services Traefik provides three types of authentication middlewares to restrict access to your services:- BasicAuth - HTTP Basic Authentication
- DigestAuth - HTTP Digest Authentication
- ForwardAuth - Delegate authentication to an external service
BasicAuth
The BasicAuth middleware grants access to services to authorized users only using HTTP Basic Authentication.Configuration Examples
Configuration Options
Array of authorized users in
name:hashed-password format. Passwords must be hashed using MD5, SHA1, or BCrypt.Use
htpasswd to generate passwords.Path to an external file containing authorized users (one per line in
name:hashed-password format).Realm for the authentication.
Header field to store the authenticated user.
Remove the authorization header before forwarding the request to your service.
DigestAuth
The DigestAuth middleware grants access to services using HTTP Digest Authentication.Configuration Examples
Use
htdigest to generate passwords.Configuration Options
Array of authorized users in
name:realm:encoded-password format.Path to an external file containing authorized users.
Realm for the authentication.
Header field to store the authenticated user.
Remove the authorization header before forwarding the request.
ForwardAuth
The ForwardAuth middleware delegates authentication to an external service. If the service responds with a 2XX code, access is granted and the original request is performed. Otherwise, the response from the authentication server is returned.Configuration Examples
Forward-Request Headers
The following request properties are provided to the forward-auth target endpoint:| Property | Header |
|---|---|
| HTTP Method | X-Forwarded-Method |
| Protocol | X-Forwarded-Proto |
| Host | X-Forwarded-Host |
| Request URI | X-Forwarded-Uri |
| Source IP | X-Forwarded-For |
Configuration Options
Authentication server address.
Trust all
X-Forwarded-* headers.List of headers to copy from the authentication server response and set on forwarded request.
Regex to match headers to copy from the authentication server response.