How to Enable Post-Quantum HTTPS with Cloudflare, NGINX, and Ubuntu
A valid HTTPS certificate tells you who you’re connected to. The negotiated key exchange tells you whether that connection uses post-quantum cryptography. Learn how to enable X25519MLKEM768 on Cloudflare, configure NGINX on Ubuntu, and verify TLS on both sides of the proxy.

An HTTPS site can have a valid certificate and still use a key exchange that a sufficiently powerful quantum computer could break. The first upgrade for a typical website is to enable hybrid key exchange in TLS 1.3 and verify that real connections negotiate it. The group you want to see is X25519MLKEM768.
On December 2, 2026, Amazon, Anthropic, Apple, Cloudflare, Google, Microsoft, OpenAI, and Oracle jointly backed US government guidance to accelerate migration to NIST’s post-quantum cryptography standards. The immediate concern for web traffic is harvest now, decrypt later. Someone can record encrypted traffic today and retain it in case a future quantum computer can recover the secrets established with classical public-key cryptography. This makes long-lived confidential data a priority for migration. Joint company statement · US government statement
What the upgrade changes
X25519MLKEM768 combines classical X25519 with ML-KEM-768, the key encapsulation mechanism standardized in NIST FIPS 203. TLS uses the resulting shared secret to derive keys for encrypting traffic. TLS 1.3 version numbers, cipher suites such as TLS_AES_128_GCM_SHA256, and certificate key types are separate signals. Read the negotiated key exchange group to verify this upgrade.
NIST’s ML-DSA and SLH-DSA standards cover digital signatures. Your existing RSA or ECDSA certificate can keep authenticating your server while the same connection uses hybrid key exchange. Moving certificate authentication to post-quantum signatures is a separate migration. NIST PQC standards · Cloudflare’s PQC deployment status
When Cloudflare proxies your site, HTTPS crosses two TLS connections.
ConnectionWhere to make the changeHow to verify it
Browser → Cloudflare edge
Cloudflare’s public TLS settings
Browser trace or OpenSSL against the public hostname
Cloudflare edge → origin
The origin’s TLS terminator and Cloudflare’s origin settings
Direct origin handshake for capability, followed by logs for actual negotiation
Browser → origin, when DNS is unproxied
The public listener on NGINX or the load balancer
OpenSSL against the public hostname
The origin is whichever component actually terminates that TLS connection. If an AWS load balancer or an ingress controller terminates TLS before NGINX, change its TLS policy and test that listener.
1. Establish a baseline
For a Cloudflare-proxied site, open https://YOUR-HOSTNAME/cdn-cgi/trace in a current browser. Inspect the tls= and kex= lines. On December 3, a Chrome connection to philon.site’s trace endpoint returned:
tls=TLSv1.3kex=X25519MLKEM768
That measured the public edge. A result such as tls=TLSv1.2 and kex=X25519 shows classical key exchange on the observed connection. Repeat the check on each real hostname that handles sensitive traffic, including www, login, and API hosts. For a site without a Cloudflare trace, Chrome DevTools can show the negotiated connection under Privacy and security → Security → main origin → Connection. Cloudflare trace endpoint · Chrome DevTools security panel
For a repeatable command-line test, use OpenSSL 3.5 or newer on your workstation or another machine that can reach the endpoint directly. Check the actual binary and whether it offers the group.
openssl versionopenssl list -tls1_3 -tls-groups
Replace example.com with the hostname being audited.
site=example.comopenssl s_client \ -connect "$site:443" \ -servername "$site" \ -verify_hostname "$site" \ -verify_return_error \ -tls1_3 \ -groups X25519MLKEM768 \ -brief </dev/null
A successful result includes these lines. Some builds label the negotiated group differently, so look for the actual group value.
CONNECTION ESTABLISHED
Protocol version: TLSv1.3
Verification: OKNegotiated TLS1.3 group: X25519MLKEM768
This test permits only the hybrid group. Run the same command without -groups X25519MLKEM768 to see what your OpenSSL client normally chooses. To troubleshoot a failed hybrid test, try -groups X25519 while keeping -tls1_3. If the classical TLS 1.3 control works, the endpoint is reachable and the forced hybrid attempt failed. OpenSSL can display the classical result as Peer Temp Key: X25519. Keep the full output during diagnosis. A filter such as grep -i group can hide the error that explains a <NULL> result. On a network that intercepts HTTPS, check the peer certificate issuer or repeat the test from a network with direct access. OpenSSL s_client documentation · OpenSSL negotiated group documentation
2. Enable TLS 1.3 at the Cloudflare edge
- In DNS → Records, confirm the hostname is Proxied. Then verify under SSL/TLS → Edge Certificates that an active certificate covers it. If the record is deliberately DNS only, configure and test the public origin.
- Go to SSL/TLS → Edge Certificates → TLS 1.3 and enable it. Cloudflare offers hybrid key exchange to compatible clients during TLS 1.3 negotiation.
- Leave Minimum TLS Version at your current supported baseline during the first rollout. A minimum of TLS 1.2 can coexist with TLS 1.3 for newer clients. Raising the minimum to TLS 1.3 is a separate compatibility decision and still does not require ML-KEM on every connection.
- Open a fresh browser connection, then repeat the trace and forced OpenSSL test. Check another network or client if you suspect HTTPS inspection or an old TLS stack.
Enabling TLS 1.3 here changes the visitor-facing connection. Proceed to the origin steps to cover traffic Cloudflare forwards to your server. Cloudflare proxy status · TLS 1.3 settings · Minimum TLS version
3. Prepare NGINX on your Ubuntu origin
Start by identifying the listener on port 443, the NGINX build and its effective configuration.
. /etc/os-release
printf '%s\n' "$PRETTY_NAME"openssl version -asudo ss -ltnp '( sport = :443 )'sudo nginx -V 2>&1sudo nginx -tsudo nginx -T 2>&1 | grep -nE 'listen .*443|ssl_protocols|ssl_ecdh_curve|ssl_conf_command|ssl_certificate'apt-cache policy nginx openssl libssl3t64
A modern openssl command is useful for testing. The NGINX binary serving port 443 must also use a TLS library that supports the hybrid group. Check the build and running library information reported by nginx -V, then confirm it with a real handshake after applying the configuration. If NGINX runs in a container, check the container’s binary and rebuild or replace the image through your usual deployment process.
Ubuntu or hosting setupWhat to do
Ubuntu 26.04 LTS with distribution packages
Ubuntu ships the OpenSSL 3.5 series. Apply supported package updates, check the NGINX build and test the origin.
Ubuntu 24.04 LTS with stock packages
Ubuntu’s OpenSSL packages are from the 3.0 series. Patch the public Cloudflare edge first. For the origin, stage a supported upgrade or replacement host, move the listener to a managed load balancer with hybrid key exchange, or use Cloudflare Tunnel.
Custom NGINX, container, or managed ingress
Check the library and policy of the component that actually serves TLS. Upgrade that component using its documented release process.
If a package upgrade changes the running binary or its SSL library, follow the package guidance to restart the affected service or reboot during a maintenance window. Reloading configuration alone can leave the existing process running older code. Use supported packages or a maintained build for the upgrade. Replacing system OpenSSL libraries by hand can break other services on the VPS. Ubuntu OpenSSL versions · Ubuntu release notes · NGINX process control
If you are moving off a 24.04 origin, bring up the replacement alongside it. Deploy the same application and certificate settings, run the direct origin test below, and verify a staging route through Cloudflare. Switch production origin traffic only after verifying both TLS legs and application health. Keep the previous origin available for rollback until the new one is stable.
Set up a verified origin certificate
For a typical proxied HTTPS site, keep SSL/TLS → Overview → Full (strict). Before switching an existing zone to it, verify the certificates on every affected origin. The TLS listener needs an unexpired certificate valid for the requested or configured origin hostname and a chain Cloudflare can validate. A public CA such as Let’s Encrypt works for direct clients and Cloudflare. A Cloudflare Origin CA certificate is suitable for an origin reached through Cloudflare and needs the matching Origin CA root for a direct OpenSSL verification test.
On a host that already uses Certbot, check its certificates and perform a renewal rehearsal. If the site needs a new public certificate and HTTP-01 can reach its challenge path on port 80, an installed Certbot NGINX plugin can issue and install it with sudo certbot --nginx -d example.com. For a private origin or a wildcard certificate, use the appropriate DNS-01 plugin. In NGINX, point ssl_certificate to the full chain and ssl_certificate_key to the matching private key. Use your existing certificate deployment and renewal mechanism. Cloudflare Full (strict) · Cloudflare Origin CA · Certbot instructions
sudo certbot certificatessudo certbot renew --dry-run
Apply the NGINX patch
Back up the configuration and record the Cloudflare settings before changing them. This example keeps the NGINX backup under root’s home directory.
backup_dir=$(sudo mktemp -d /root/nginx-pqc.XXXXXX)
sudo cp -a /etc/nginx "$backup_dir/"
printf 'NGINX backup: %s\n' "$backup_dir"Open the TLS configuration used by your listener. On an Ubuntu install it may be a file under /etc/nginx/sites-available/ linked from sites-enabled/. Check the nginx -T output for the actual source and includes. Set the protocol list once in the appropriate http or default TLS server context for that listener. NGINX can select protocols before the final virtual host is chosen by SNI, so a conflicting default server can prevent a per-site change from working.
# In the existing http block or default TLS server for this listener.ssl_protocols TLSv1.2 TLSv1.3;
Start with OpenSSL’s default groups. NGINX uses the OpenSSL defaults with ssl_ecdh_curve auto;, and OpenSSL 3.5 puts X25519MLKEM768 first in its default list. If your config inherits an older explicit curve list or includes a custom Groups setting, review that override. Replace the existing rule in the appropriate context instead of copying a second directive into it. Certbot-generated includes may already define some TLS directives.
For an origin that needs an explicit reviewed group policy, use the following in the relevant http or TLS server context. Include the classical curves your clients and ECDSA certificates require. NGINX inherits ssl_conf_command directives only when the child context defines none, so preserve any other OpenSSL commands you depend on when adding a server-level override. NGINX TLS module · OpenSSL group configuration
# Optional explicit policy for an NGINX build with OpenSSL 3.5+.ssl_conf_command Groups X25519MLKEM768:X25519:prime256v1:secp384r1;
Keep your application routes, uploads, WebSocket settings and reverse-proxy configuration in place. Validate and reload NGINX, then test a normal request as well as a fresh TLS handshake.
sudo nginx -t && sudo systemctl reload nginx
sudo systemctl is-active nginxsudo journalctl -u nginx --since "10 minutes ago" --no-pager
Test the origin directly
Run from the VPS or another machine permitted to reach the origin. Use 127.0.0.1 only if the TLS listener is bound there or on all interfaces. Otherwise use the private listener address or the configured origin load balancer. Use the SNI Cloudflare actually sends, accounting for any origin rule that overrides it. Keep the public DNS record proxied during the test.
origin_addr=127.0.0.1
origin_sni=example.com
openssl s_client \
-connect "$origin_addr:443" \
-servername "$origin_sni" \
-verify_hostname "$origin_sni" \
-verify_return_error \
-tls1_3 \
-groups X25519MLKEM768 \
-brief </dev/nullWhen testing a Cloudflare Origin CA certificate, add -CAfile /path/to/matching-cloudflare-origin-ca-root.pem using the root obtained from the official Origin CA docs. A certificate or hostname failure still needs to be fixed even when the server offers the right TLS group. A passing direct test proves the selected listener accepts the hybrid group. The next step measures Cloudflare’s origin connection.
4. Verify Cloudflare is using PQC on origin traffic
In SSL/TLS → Overview → Origin connection & post-quantum encryption, confirm Automatic key exchange is enabled for a standard proxied HTTPS origin. Cloudflare’s documented behavior is to prefer the standardized hybrid group when an active TLS 1.3 origin supports it. Cloudflare scans active origins approximately every 24 hours and rolls out a new preference in stages. Check real traffic before assuming deployment is complete. If the zone uses multiple origins, test every origin that can serve the route.
Keep the compliance requirement unset during the initial rollout. Enforcing Post-quantum hybrid before dependent endpoints are ready can cause HTTP 525 errors. The requirement applies to outbound TLS 1.3 in the zone context and can also affect Workers’ outbound fetches. It cannot force a TLS 1.2 connection to become TLS 1.3. Cloudflare automatic origin key exchange · Post-quantum TLS to origin
Verify a request against an existing uncached route that reaches the origin. Use its Cloudflare Ray ID to match the request in your logs where available.
- Cloudflare telemetry — inspect
ClientTLSKeyExchangeGroupfor the visitor leg andOriginTLSKeyExchangeGroupfor the origin leg in the HTTP Requests dataset. An origin value ofX25519MLKEM768confirms the group on that request.UNKcan occur when the group cannot be determined or when a cache hit avoided an origin connection. - NGINX telemetry — when NGINX is the TLS terminator and the variables are available in your build, add $ssl_protocol and $ssl_curve to the access log format in use. Some builds render unfamiliar groups as hexadecimal. If you see hex, interpret it against the NGINX and TLS implementation before using it as evidence. Match a Cloudflare request using $http_cf_ray where present and confirm it came through the expected proxy.
Cloudflare HTTP request log fields · NGINX TLS variables
If you use Cloudflare Tunnel
Treat Cloudflare → cloudflared and cloudflared → your app as distinct connections. Cloudflare Tunnel supports post-quantum key agreement on its connector transport. Cloudflare documents PQ key agreement by default for QUIC with the possibility of fallback, and a --post-quantum option for tunnels that must require it. Check the connector version and transport before enforcing the flag. If cloudflared forwards to another host across a network segment, secure that hop as well. Cloudflare Tunnel run parameters · PQC support in Cloudflare products
5. Diagnose failures and roll back safely
What you observeWhat to check
X25519MLKEM768 is missing from the local group list
Verify the client binary and its provider configuration. On macOS or a VPS, a different OpenSSL binary may be earlier in your PATH.
TLS 1.3 works with X25519 but the forced hybrid test fails
Check the actual TLS terminator, its TLS library, configured groups, and any TLS-inspecting device in the path. Test one known-good endpoint with the same client as a control.
Browser trace shows TLS 1.2 on Cloudflare
Check the zone’s TLS 1.3 setting and the same hostname from a fresh connection or a second network.
HTTP 525 starts during rollout
Check the origin handshake and NGINX logs. If this followed a new strict group requirement, remove the requirement and restore automatic negotiation while investigating.
HTTP 526 appears
Fix the origin certificate’s hostname, validity, or chain and retest with the correct SNI and trust store. Keep certificate verification in place.
NGINX rejects the patch
Read the nginx -t error. Check for a duplicate directive, an unsupported group, or a misplaced include before reloading.
For an NGINX-only change, restore the exact files you edited from the backup, remove any new include you added, and run sudo nginx -t && sudo systemctl reload nginx. For a binary, image, or OS migration, use the known-good image or origin from your staged rollout. Confirm recovery on an uncached route and recheck both TLS legs. Cloudflare 525 guide · Cloudflare 526 guide
Before closing the rollout, record the hostname, each TLS leg, the negotiated group and the date tested. Check certificate renewal, API calls, sign-in, and any WebSocket clients you support. The evidence you want is a successful live connection showing X25519MLKEM768 on every TLS leg you intend to protect.





