# HAProxy: TLS 1.3 only, ECDSA only, HSTS with subdomains

- Kind: example config
- Tested: no, built from documentation
- Web page: https://tldrtls.com/configs/haproxy-tls13-ecdsa-sub/
- Other combinations: https://tldrtls.com/configs.md

Needs an HAProxy build with OpenSSL 3.5 or later. Each `.pem` file holds the certificate chain and its key. Swap `example.com` and the paths for your own.

```haproxy
global
    ssl-default-bind-options ssl-min-ver TLSv1.3 no-tls-tickets
    ssl-default-bind-curves X25519MLKEM768:X25519:secp384r1

frontend web
    mode http
    bind :80
    bind :443 ssl crt /etc/haproxy/certs/example.com.pem alpn h2,http/1.1
    http-request redirect scheme https code 301 unless { ssl_fc }
    http-response set-header Strict-Transport-Security "max-age=63072000; includeSubDomains"
    http-response set-header X-Content-Type-Options "nosniff"
    http-response set-header Referrer-Policy "strict-origin-when-cross-origin"
    default_backend app

backend app
    mode http
    server app1 127.0.0.1:8080
```

## What it does

- Accepts TLS 1.3 only. See [protocol versions](https://tldrtls.com/protocol-versions.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).
- Expects one ECDSA P-384 certificate. 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).
- Turns session tickets off. 0-RTT is off unless you add `allow-0rtt`. 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`.
