# Post-quantum TLS on nginx, HAProxy and other OpenSSL servers

> Servers linked to OpenSSL 3.5 offer X25519MLKEM768 by default. Check the linked OpenSSL, fix a pinned ssl_ecdh_curve, and verify from the outside.

Source: https://pqshift.dev/learn/post-quantum-tls-nginx · Published 2026-12-04 · Updated 2026-12-04 · pqshift

Any TLS server linked against OpenSSL 3.5 or later offers the hybrid post-quantum group `X25519MLKEM768` by default; OpenSSL 3.5's default key shares are `X25519MLKEM768` and `X25519`. For nginx, HAProxy, Apache and Postfix the work is: make sure the server binary links OpenSSL 3.5+, and remove any curve list that pins classical groups. No new certificates are needed.

## Which OpenSSL is your server actually running?

```bash
nginx -V 2>&1 | grep -i "openssl"                # "built with" and "running with" versions
haproxy -vv | grep -i "openssl"
grep -rn "ssl_ecdh_curve\|curves\|ssl-default-bind-curves\|SSLOpenSSLConfCmd" /etc/nginx /etc/haproxy /etc/apache2 2>/dev/null
```

Two things to read carefully:

- **Running with**, not just *built with*. A server built against 3.0 headers but running with a 3.5 library is fine; the reverse is not.
- **Statically linked builds** (some vendor packages, some container images) carry their own OpenSSL regardless of the OS.

## nginx

With OpenSSL 3.5+ and `ssl_ecdh_curve` at its default (`auto`), nginx already offers the hybrid group. If you pin curves, put the hybrid first and keep classical fallbacks:

```nginx
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;
```

The directive is passed to OpenSSL as a group list, so any OpenSSL 3.5 group name works. On an older OpenSSL, `X25519MLKEM768` is unknown and `nginx -t` fails, which is a useful safety net. Reload with `nginx -t && nginx -s reload`.

## HAProxy

```haproxy
global
    ssl-default-bind-curves X25519MLKEM768:X25519:P-256:P-384
```

Or per `bind` line with the `curves` keyword. Leave both unset to use the OpenSSL defaults, and make sure HAProxy itself runs with OpenSSL 3.5+.

## Apache httpd

```apache
SSLOpenSSLConfCmd Groups X25519MLKEM768:X25519:prime256v1:secp384r1
```

## Load balancers and CDNs

If TLS terminates at a managed load balancer or CDN, its configuration decides what browsers negotiate. Several CDNs already negotiate `X25519MLKEM768` with browsers by default; Cloudflare Radar reports that most human HTTPS traffic it sees is now post-quantum. Check two hops separately:

1. **Browser to edge**: test from outside with the commands below.
2. **Edge to origin**: often still classical. Look for an origin post-quantum setting in your provider, and make sure the origin server itself (nginx, your app) supports the hybrid group.

## Verify from the outside

```bash
openssl s_client -connect example.com:443 -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -i group
openssl s_client -connect example.com:443 -groups X25519 </dev/null 2>/dev/null | grep -i group   # classical fallback still works
```

Your test client also needs OpenSSL 3.5+, or it can't offer the group. More in [How to check if a server uses post-quantum TLS](https://pqshift.dev/learn/test-post-quantum-tls).

## Large ClientHello and middleboxes

A hybrid key share adds about 1.2 KB to the ClientHello, so it often spans two TCP packets. Correct TLS stacks handle this; some old firewalls, IDS appliances and TLS-inspecting proxies did not, which shows up as connections that hang or reset only for hybrid-capable clients. If you see that, fix or update the middlebox rather than turning off the hybrid group. See [X25519MLKEM768 explained](https://pqshift.dev/learn/x25519mlkem768-explained).

[pqshift](https://pqshift.dev/) detects pinned curve lists in nginx, Caddy and HAProxy configs and OpenSSL versions in Dockerfiles, and adds a CI check that proves the hybrid handshake on every change.

## FAQ

### How do I enable post-quantum TLS in nginx?

Run nginx linked to OpenSSL 3.5+. With ssl_ecdh_curve left at auto, X25519MLKEM768 is offered by default. If you pin curves, use ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;

### Does post-quantum TLS need new certificates?

No. Hybrid key exchange changes only the key agreement. Your existing RSA or ECDSA certificates keep working; post-quantum certificates are a separate, later step.

## Sources

- [OpenSSL 3.5 release announcement](https://openssl-library.org/post/2025-03-25-openssl-3.5-beta/)
- [OpenSSL SSL_CTX_set1_groups_list (group list format)](https://docs.openssl.org/3.5/man3/SSL_CTX_set1_curves/)
- [nginx ssl_ecdh_curve directive](https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ecdh_curve)
