WEB-159Recommended
Serve over HTTP/2 or HTTP/3
Serve the site over HTTP/2 at least, and over HTTP/3 where the server supports it.
How to do it
Turn on HTTP/2 in the front server. nginx before 1.25.1 uses listen 443 ssl http2, and newer versions use http2 on. Add HTTP/3 with an Alt-Svc header, and open UDP port 443. Alt-Svc helps only from the second visit. Also publish an HTTPS DNS record (RFC 9460) with alpn="h3,h2", so browsers can use HTTP/3 on the first. Where your CDN or server supports TLS Encrypted Client Hello (RFC 9849), turn it on. It hides the host name from the network, and its keys travel in the same HTTPS record. Then remove the tricks HTTP/2 makes harmful, as Old HTTP/1 tricks on HTTP/2 says.
Examples
nginx example
server { # nginx 1.25.1 and later
listen 443 ssl;
listen 443 quic reuseport; # HTTP/3
http2 on;
server_name example.com;
add_header Alt-Svc 'h3=":443"; ma=86400';
}
How to check
curl -so /dev/null -w '%{http_version}' https://example.com/ prints 2. With HTTP/3 on, curl --http3-only prints 3, and dig +short HTTPS example.com shows alpn with h3.
Measured
In an earlier lab at a 100 ms round trip, moving from HTTP/1.1 to HTTP/2 took "everything loaded" from 624 to 526 ms.
Sources
Related rules
- WEB-41 Send early hints only when they help in Website
- WEB-51 Old HTTP/1 tricks on HTTP/2 in Website
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/hosting-and-network/http3">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.