This episode opens the TLS phase: TLS termination versus TLS passthrough, TLS version and cipher suite settings via TLSOption, certificate sources from files, Let's Encrypt, and custom CA, plus the default certificate and the role of SNI in selecting the right certificate.

Episode 14 marks a big transition: from plaintext HTTP to HTTPS. This TLS phase contains four episodes that successively strengthen transport security. In this episode, we build the basic understanding of TLS in Traefik: what TLS termination is, what passthrough is, how to configure versions and cipher suites, where certificates come from, and how SNI determines which certificate is used.
The most important concept here: TLS termination is Traefik's default. Traefik holds the certificate, handles the handshake with the client, then forwards the request in plaintext (or re-encrypted) to the backend. This centralizes all certificate management in one place — one of the reasons Traefik is so well liked.
In TLS termination, the TLS handshake happens at Traefik. Traefik holds the private key, decrypts traffic, and can route based on the request. Because traffic is already decrypted, all HTTP middlewares — headers, rate limit, auth — work normally. This is the default mode.
In TLS passthrough, Traefik only passes the intact TLS connection to the backend without decrypting. Traefik only sees SNI for routing and cannot apply HTTP middlewares. The backend holds its own certificate. This is used for non-HTTP protocols or end-to-end encryption requirements.
tcp:
routers:
db-tcp:
rule: "HostSNI(`db.example.com`)"
entrypoints:
- db
service: db-svc
tls:
passthrough: true
services:
db-svc:
loadBalancer:
servers:
- address: "10.0.0.60:5432"TLS passthrough on a TCP router opens a direct connection to the database without Traefik ever seeing its contents. We dissect TCP routing deeper in episode 18.
TLSOption is the resource that governs TLS behavior: minimum and maximum versions, cipher suites, curve preferences, and client authentication. An example of a safe standard:
http:
tlsOptions:
hardened:
minVersion: VersionTLS12
maxVersion: VersionTLS13
cipherSuites:
- TLS_AES_128_GCM_SHA256
- TLS_AES_256_GCM_SHA384
curvePreferences:
- CurveP256
- CurveP384
sniStrict: trueminVersion: VersionTLS12: rejects obsolete TLS 1.0 and 1.1.cipherSuites: restricts the accepted encryption algorithms. For TLS 1.3, only AEAD suites are available.curvePreferences: the preferred ordering of elliptic curves.sniStrict: true: rejects connections whose SNI does not match any certificate.A TLSOption is attached to a router by name:
http:
routers:
app:
rule: "Host(`app.example.com`)"
entrypoints:
- websecure
service: app-svc
tls:
options: hardenedCertificates for Traefik can come from three sources:
All certificates are stored in the certificate store named default. When a request arrives, Traefik matches the client's SNI against the available certificates. If nothing matches, Traefik uses the default certificate as a fallback.
The default certificate is a safety net: if Traefik cannot find a certificate matching the SNI, it sends this default certificate. Without any settings, Traefik uses an internally generated self-signed certificate. For production, define your own:
tls:
stores:
default:
defaultCertificate:
certFile: /certs/default.crt
keyFile: /certs/default.keySNI is the TLS extension where the client states the host name it wants before the handshake completes. This is what allows Traefik to serve many domains from one IP: the client says "I want app.example.com", Traefik selects the app.example.com certificate.
openssl s_client -connect app.example.com:443 -servername app.example.com -showcertsThe openssl s_client command above shows the full certificate chain Traefik sends based on SNI. Use a different -servername to verify that each domain receives the correct certificate — standard debugging for multi-domain TLS issues.
Warning
Without correct SNI, old clients or tools that do not send SNI will receive the default certificate and fail verification. Make sure all modern clients send SNI — practice since TLS 1.0.
Key takeaways:
In episode 15 next we will cover Let's Encrypt & ACME — the ACME protocol, certificate resolver configuration with email and storage, the three challenge types, and certificate lifecycle management including automatic renewal. This is the feature that makes HTTPS in Traefik almost effortless.