Quick Answer: To enable HAProxy post-quantum cryptography, you need a TLS library that supports ML-KEM, such as OpenSSL 3.5 or later. Then add a
curvesdirective that lists the hybrid groupX25519MLKEM768ahead of classical groups. Verify the negotiated group withopenssl s_client. Your certificates stay classical, so this protects session confidentiality, not server identity.
Most of the internet's encrypted traffic was never designed to survive a future quantum computer. Anyone recording your TLS sessions today can store them and decrypt them later, once a cryptographically relevant quantum computer exists. A Hacker News thread on enabling this at the proxy layer caught attention for a reason: the fix for your edge is smaller than most people expect. This guide walks through the change in HAProxy, how to confirm it works, and where the protection stops.
Why Key Exchange Is the First Thing to Fix
Post-quantum migration splits into two problems that people often blur together. Key exchange decides which secret protects your session. Authentication decides whether the server is who it claims to be. The first problem is urgent because of harvest-now-decrypt-later: an adversary who captures traffic today can unlock it years from now. The second problem matters too, but a forged signature has to be exploited in real time, which makes it a different threat.
NIST finalized its first post-quantum standards in August 2024: FIPS 203 (ML-KEM, for key encapsulation), FIPS 204 (ML-DSA, for signatures), and FIPS 205 (SLH-DSA, a hash-based signature scheme). ML-KEM is the one that matters for your TLS termination today. Most real deployments use a hybrid group, X25519MLKEM768, which combines classical X25519 with ML-KEM-768. You get the post-quantum protection, and if ML-KEM turns out to have a flaw, X25519 still holds.
Here's the counter-intuitive part. Teams often start with certificate migration because it sounds like the bigger job. For most edges, enabling hybrid key exchange first is the higher-value move, because it protects the traffic that's already being recorded.
Check Your TLS Library Before Touching HAProxy
HAProxy doesn't implement post-quantum algorithms itself. It delegates TLS to a library, so the library version sets your ceiling. A HAProxy config that names X25519MLKEM768 will fail to start, or silently fall back, if the underlying library doesn't know the group.
Run haproxy -vv and look at the SSL library line. Then check what that library supports:
| TLS library | ML-KEM / hybrid support | What you need to know |
|---|---|---|
| OpenSSL 3.5 or later | Native ML-KEM, with X25519MLKEM768 available for TLS 1.3 | Current mainline option; OpenSSL 3.5 shipped in 2025 with PQ algorithms built in |
| OpenSSL 3.0 to 3.4 | Only through the oqs-provider add-on | Works, but you own the provider build, patching, and compatibility testing |
| AWS-LC | ML-KEM support in the TLS stack | Common in AWS-oriented builds; confirm your HAProxy build links against it |
| wolfSSL | ML-KEM support in recent releases | Typical in embedded or appliance builds; check your vendor's version |
The trade-off is straightforward. Staying on an older system OpenSSL means you either wait for an OS upgrade or maintain a provider yourself. Upgrading the library is usually the cleaner path, because the hybrid group ships in the default TLS 1.3 negotiation without extra config.
Here's where most guides go wrong: they assume the HAProxy version alone decides support. It doesn't. A recent HAProxy linked against an old OpenSSL will reject the group, and you'll blame HAProxy for a library problem.
Configure the Hybrid Group in HAProxy
Once your library is current, the change is a single directive. The curves option on a bind line, or ssl-default-bind-curves in the global section, controls which key exchange groups HAProxy offers. Put the hybrid group first and keep classical fallbacks so clients that don't support ML-KEM can still connect.
global
ssl-default-bind-curves X25519MLKEM768:X25519:prime256v1
frontend https_in
bind :443 ssl crt /etc/haproxy/certs/ curves X25519MLKEM768:X25519:prime256v1
default_backend app_servers
Keep the fallbacks. If you list only X25519MLKEM768, older clients and some middleboxes fail the handshake, and you'll see a spike in connection errors that looks like an outage. Ordering matters because the server picks from the client's offer in its own preference order, so the hybrid group needs to sit first.
Validate the config before reloading:
- Run
haproxy -c -f /etc/haproxy/haproxy.cfgto catch syntax and group-name errors. - Reload with
systemctl reload haproxyduring a low-traffic window, not at peak. - Keep the previous config file ready so you can roll back in seconds.
Most people stop here. Don't. A clean reload only proves the config parses, not that clients negotiate the new group.
Verify the Negotiated Group
Confirm the change from the outside, the way a real client sees it. OpenSSL 3.5 and later let you request a specific group with the -groups flag:
openssl s_client -connect example.com:443 -tls1_3 -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -i "group"
Look for the negotiated group line in the output. If it shows X25519MLKEM768, the hybrid exchange worked. If the handshake fails, your client-side OpenSSL is too old to offer the group, which tells you nothing about HAProxy. Test with a current client before you blame the proxy.
For a broader check, run a scan across your public endpoints and compare the results against your inventory. You're looking for two things: which endpoints negotiate the hybrid group, and which ones still fall back to classical-only. The second list is your migration backlog.
The Leg Most Teams Forget: Backend Connections
Here's the part practitioners don't advertise. TLS termination at HAProxy protects the connection from the client to the proxy. It doesn't protect the connection from HAProxy to your application servers, unless those servers also speak TLS with a PQ-capable stack. Many architectures terminate TLS at the edge and forward plaintext or classical TLS internally.
That's not automatically a problem. If your internal network is segmented and you trust it, the exposure is much smaller than the public internet. But if traffic crosses hosts, clouds, or data centers you don't fully control, you have a gap. The recorded-traffic threat applies to that internal hop too, if an attacker can capture it.
Plan the backend as a separate project. Either upgrade the backend TLS stack to match, or document the residual risk and the network controls that limit it. Pretending the proxy solves the whole path is the mistake that causes audit findings later.
Handling the Practical Failure Modes
Hybrid key exchange has a cost that shows up in packet sizes. The ML-KEM-768 public key is 1,184 bytes, so the TLS ClientHello grows substantially. When a client's ClientHello no longer fits in a single packet, some middleboxes, load balancers, and older firewalls mishandle the fragmented handshake. The symptom is intermittent failures for specific networks, not a clean error.
When this happens, you'll see it in logs as handshake timeouts from particular ISPs or corporate networks. Check whether the failing clients offer the hybrid group, then test with the group removed from your curves list. If the failures disappear, the problem is on the path, and you'll need to fix the middlebox or accept a classical fallback for those clients.
Cause and effect is direct here: a larger ClientHello crosses an MTU or inspection boundary, the middlebox drops or stalls the handshake, and the user sees a connection that hangs rather than fails. Measure before you assume the proxy is the culprit.
Certificates Are Still Classical
This is the limitation you need to state clearly to your team. Enabling ML-KEM protects session keys. Your server certificate is still signed with RSA or ECDSA, which quantum computers can break in principle. That's an authentication risk, and it doesn't get fixed by the proxy change.
ML-DSA exists, and migrating certificates to it depends on your CA, your clients, and your trust stores. It's a longer project with its own compatibility tests. The sensible sequencing is to enable hybrid key exchange now, because it protects recorded traffic, and track certificate migration as a separate workstream.
Frequently Asked Questions
does haproxy support post-quantum cryptography?
Yes, indirectly. HAProxy uses the TLS library it's built against, so post-quantum support depends on that library. With OpenSSL 3.5 or later, you can offer the hybrid X25519MLKEM768 group by setting the curves directive. Run haproxy -vv to see which library your build uses.
what is X25519MLKEM768?
It's a hybrid TLS key exchange group that combines the classical X25519 elliptic-curve exchange with ML-KEM-768, the post-quantum key encapsulation mechanism standardized in NIST FIPS 203. The session key stays secure as long as at least one of the two components holds, which is why hybrid is the recommended deployment.
how do i enable post-quantum tls in haproxy?
Upgrade to a TLS library with ML-KEM support, then add the hybrid group to your curves setting with classical fallbacks, such as X25519MLKEM768:X25519:prime256v1. Validate with haproxy -c, reload, and confirm with openssl s_client -groups X25519MLKEM768.
why does my post-quantum tls handshake fail for some users?
The most common cause is a larger ClientHello, because the ML-KEM-768 public key is 1,184 bytes. Some middleboxes and older firewalls mishandle fragmented handshakes. Confirm by testing with the hybrid group removed from your config. If the failures stop, the issue is on the network path, not in HAProxy.
does post-quantum key exchange protect my certificates?
No. Hybrid key exchange protects the confidentiality of session keys against recorded-traffic attacks. Server certificates still use classical signatures, so authentication needs a separate migration to ML-DSA or another post-quantum signature scheme.
Enable It This Week and Measure the Result
Pick one public endpoint, check your OpenSSL version, add the hybrid group to its curves line, and run the openssl s_client test before you touch anything else. Then note the negotiated group and any client errors over the next 48 hours. If you're planning a wider rollout, pass this to whoever owns your edge TLS config, since they're the one wrestling with the library upgrade.