Connection Policy
Connection policies are evaluated in order; the first matching policy will be used to configure the TLS connection.An empty policy is valid. Safe and sensible defaults will be used.
Policy Matching
object
How to match this policy with a TLS ClientHello.If this policy is the first to match, it will be used. Available matchers:
sni- Server Name Indicationremote_ip- Client IP address- Other custom connection matchers
TLS Protocol Settings
array
The list of cipher suites to support.Supported cipher suites:
Caddy’s defaults are modern and secure. Only customize if you have specific requirements.
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256TLS_AES_128_GCM_SHA256(TLS 1.3)TLS_AES_256_GCM_SHA384(TLS 1.3)TLS_CHACHA20_POLY1305_SHA256(TLS 1.3)
array
The list of elliptic curves to support.Caddy’s defaults are modern and secure.Supported curves:
x25519secp256r1(P-256)secp384r1(P-384)secp521r1(P-521)
string
default:"tls1.2"
Minimum TLS protocol version to allow.Values:
tls1.2, tls1.3string
default:"tls1.3"
Maximum TLS protocol version to allow.Values:
tls1.2, tls1.3array
Protocols to use for Application-Layer Protocol Negotiation (ALPN) during the handshake.Default:
["h2", "http/1.1"] (enables HTTP/2 and HTTP/1.1)Certificate Selection
object
How to choose a certificate if more than one matches the given ServerName (SNI) value.Can specify criteria like public key algorithm, serial number, subject organization, etc.
string
DefaultSNI becomes the ServerName in a ClientHello if there is no policy configured for the empty SNI value.
string
FallbackSNI becomes the ServerName in a ClientHello if the original ServerName doesn’t match any certificates in the cache.Use cases are very niche. Typically useful if a client (like a CDN) passes through the ServerName of the downstream handshake but can accept a certificate with the origin’s hostname instead.
EXPERIMENTAL: Subject to change or removal.
Client Authentication
object
Enables and configures TLS client authentication (mutual TLS).
string
The mode for authenticating the client.
Default is
require_and_verify if trust pool is provided; otherwise require.object
Certificate authority module which provides the certificate pool of trusted certificates.Available providers:
inline- Base64 DER-encoded CA certificatesfile- Load CA certificates from PEM filespki- Use CA from Caddy’s PKI app
array
Client certificate verification modules.These can perform custom client authentication checks, such as ensuring the certificate is not revoked.Available verifiers:
leaf- Verify against specific leaf certificates
Advanced Settings
boolean
default:"false"
Reject TLS connections that match this policy.
string
Also known as “SSLKEYLOGFILE”. TLS secrets will be written to this file in NSS key log format.
EXPERIMENTAL: Subject to change or removal.
Configuration Examples
Basic Connection Policy
Client Authentication (Mutual TLS)
Inline CA Certificates
Leaf Certificate Verification
Custom Cipher Suites
SNI-Based Policy Matching
Caddyfile Configuration
Basic TLS Settings
Client Authentication
Multiple Policies
Session Tickets
Caddy automatically manages session tickets for resumption unless disabled:Best Practices
Default Settings: Caddy’s default cipher suites and protocols are carefully selected for security and compatibility. Only customize if you have specific requirements.
Protocol Versions: TLS 1.3 offers better performance and security. Only allow TLS 1.2 if you need to support older clients.