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.
TLS Configuration
Traefik provides comprehensive TLS configuration options for securing your services, including custom certificates, TLS versions, cipher suites, and mutual TLS authentication.Certificate Definition
Manual Certificates
Define certificates manually in the dynamic configuration:Certificates can be defined using the file provider only. In Kubernetes, use Secrets instead.
Certificate Content vs. File Path
Certificates can be provided as file paths or inline content:- File Path
- Inline Content
Kubernetes Secrets
In Kubernetes, certificates are provided through Secrets:Certificate Stores
Certificates are organized in stores. Only thedefault store is available:
Default Certificate
The default certificate is used for connections without SNI or without a matching domain:If no default certificate is configured, Traefik generates a self-signed certificate automatically.
TLS Options
TLS options control the TLS connection parameters.Minimum TLS Version
Set the minimum TLS version to enforce:VersionTLS10(not recommended)VersionTLS11(not recommended)VersionTLS12(recommended minimum)VersionTLS13(recommended)
Maximum TLS Version
Limit the maximum TLS version (not recommended):Disabling TLS 1.3 is discouraged. Update clients to support TLS 1.3 instead.
Cipher Suites
Configure allowed cipher suites for TLS 1.2 and below:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
TLS 1.3 cipher suites are not configurable. All TLS 1.3 cipher suites are considered secure.
Curve Preferences
Specify elliptic curves for key exchange:CurveP256/secp256r1CurveP384/secp384r1CurveP521/secp521r1X25519/x25519X25519MLKEM768/x25519mlkem768(post-quantum)
ALPN Protocols
Configure Application-Layer Protocol Negotiation:["h2", "http/1.1", "acme-tls/1"]
Strict SNI Checking
Reject connections without valid SNI:With
sniStrict: true, Traefik rejects connections from clients that don’t specify a server_name extension or don’t match any configured certificates.Client Authentication (mTLS)
Enable mutual TLS authentication to verify client certificates:Client Auth Types
| Type | Description |
|---|---|
NoClientCert | No client certificate required or verified |
RequestClientCert | Request certificate but don’t require it |
RequireAnyClientCert | Require certificate but don’t verify it |
VerifyClientCertIfGiven | Verify certificate only if provided |
RequireAndVerifyClientCert | Require and verify client certificate |
VerifyClientCertIfGiven
If client sends a certificate, it must be valid. Otherwise, connection proceeds.
Using TLS Options in Routers
Apply TLS options to routers:The
default TLS option is applied automatically if no option is specified. When referencing options from other providers, include the provider namespace (e.g., myoptions@file).Disable Session Tickets
Force full TLS handshake on every connection:Complete Configuration Examples
Production TLS Configuration
mTLS Configuration
Development Configuration
Security Best Practices
Implement Certificate Rotation
Regularly rotate certificates and maintain proper certificate lifecycle management.
Troubleshooting
Certificate Not Found
- Check File Paths
- Verify Permissions
- Validate Certificate
Verify certificate and key file paths are correct and accessible:
TLS Handshake Failures
- Cipher suite mismatch: Client doesn’t support any configured cipher suites
- Protocol version mismatch: Client TLS version below
minVersion - SNI issues: Enable debug logging to see SNI values
- Certificate chain issues: Ensure intermediate certificates are included
Client Certificate Errors
- CA not trusted: Verify CA file path in
caFiles - Certificate expired: Check client certificate validity
- Wrong clientAuthType: Adjust based on requirements
Enable debug logging for detailed TLS connection information: