# Caddy: Keep TLS 1.2, ECDSA only, HSTS with subdomains

- Kind: example config
- Tested: yes, on Caddy 2.11, on 3 Dec 2026, with test certificates
- Web page: https://tldrtls.com/configs/caddy-tls12-ecdsa-sub/
- Other combinations: https://tldrtls.com/configs.md

Needs Caddy 2.10 or later for the post-quantum group. Caddy gets and renews the certificate itself and redirects HTTP to HTTPS. Swap `example.com` and the paths for your own.

```caddy
example.com {
	tls {
		protocols tls1.2 tls1.3
		curves x25519mlkem768 x25519 secp384r1
		key_type p384
	}
	header Strict-Transport-Security "max-age=63072000; includeSubDomains"
	header X-Content-Type-Options "nosniff"
	header Referrer-Policy "strict-origin-when-cross-origin"
	root * /var/www/example.com
	file_server
}
```

## What it does

- Accepts TLS 1.3 and TLS 1.2. On TLS 1.2 it allows only suites with forward secrecy and modern encryption. A TLS 1.2 connection gets no post-quantum protection. See [protocol versions](https://tldrtls.com/protocol-versions.md) and [cipher suites](https://tldrtls.com/cipher-suites.md).
- Offers the hybrid post-quantum group first, then X25519 and P-384. P-256 is not offered. See [post-quantum key exchange](https://tldrtls.com/post-quantum-key-exchange.md).
- Asks for an ECDSA P-384 certificate key. See [certificate strength](https://tldrtls.com/certificate-keys.md).
- Sends HSTS for this hostname and every subdomain. Be sure all of them serve HTTPS first. See [HSTS](https://tldrtls.com/hsts.md).
- Leaves 0-RTT off, which is Caddy's default. Session tickets stay on: Caddy sends them and rotates the ticket keys itself, and the Caddyfile has no setting to turn them off. See [0-RTT and session tickets](https://tldrtls.com/zero-rtt-and-tickets.md).

## What it leaves out

- OCSP stapling. See [revocation](https://tldrtls.com/revocation.md).
- A Content-Security-Policy. It depends on what your pages load.
- HTTP/3. We haven't tested it.

## Check what you deployed

```sh
openssl s_client -connect example.com:443 -groups X25519MLKEM768 -brief </dev/null
```

The output should include `Negotiated TLS1.3 group: X25519MLKEM768`.
