Web hosting

HTTP/2 and HTTP/3

Definition

HTTP/2 and HTTP/3 are the recent versions of the web's protocol. HTTP/2 carries many requests in parallel over a single TCP connection, as binary frames with compressed headers; HTTP/3 keeps that principle but runs on QUIC, over UDP, so that a lost packet only delays its own stream.

HTTP/2 and HTTP/3, Web hosting

A WordPress page is rarely a single file: there's the HTML, then dozens of stylesheets, scripts, images and fonts. With HTTP/1.1, each connection handles only one request at a time, which forces the browser to open several connections and wait in line. HTTP/2 and then HTTP/3 were designed to carry these many small exchanges more efficiently, without changing what requests mean: methods, status codes and headers stay the same.

HTTP/2: multiplexing

HTTP/2, now specified in RFC 9113 (which obsoletes RFC 7540), splits messages into binary frames. Each exchange becomes a stream, and many streams travel at the same time over a single connection: a slow stream no longer holds up the others. Headers, highly repetitive from one request to the next, are compressed with HPACK.

The RFC acknowledges one limitation: TCP head-of-line blocking isn't solved. If a packet is lost, TCP holds back everything that follows until it's retransmitted, and all streams wait. For HTTP/2 over TLS, the standard requires TLS 1.2 or later, and the Apache documentation notes that most browsers only speak HTTP/2 with https URLs.

Three-column comparison. HTTP/1.1: text, one request at a time per connection, the browser opens several TCP connections, headers repeated in plain text. HTTP/2: binary frames, many streams multiplexed over a single TCP connection, headers compressed with HPACK, but one lost TCP packet blocks every stream. HTTP/3: the same multiplexing over QUIC on top of UDP, built-in TLS 1.3 encryption, QPACK compression, a lost packet only delays its own stream, advertised by the Alt-Svc header.

HTTP/3: a new transport

HTTP/3 (RFC 9114) keeps the same model, but runs over QUIC (RFC 9000), a secure transport protocol carried in UDP datagrams. QUIC manages streams itself: they are independent, and a loss only delays the stream concerned. TLS 1.3 encryption is part of the handshake, which cuts the number of round trips before the first byte, and a connection can survive a network change, from Wi-Fi to 4G for example. Header compression moves to QPACK.

The browser discovers HTTP/3 through the Alt-Svc header, sent during a first connection over HTTP/2 or HTTP/1.1: it says the same site also answers over h3, on a UDP port. If a firewall blocks UDP, the browser simply stays on HTTP/2.

For WordPress

  • Check which version is in use in the Network tab of the browser's developer tools (Protocol column: h2 or h3).
  • The easiest route is often a CDN, which speaks HTTP/3 to visitors whatever your server. LiteSpeed offers it too; for Nginx, the HTTP/3 module has been available since version 1.25.0, still described as experimental in its documentation.
  • On Apache, HTTP/2 goes through mod_http2 and the Protocols h2 http/1.1 directive; the documentation recommends the event MPM, because with prefork a connection handles only one request at a time.
  • Open UDP port 443 in the server firewall if you turn on HTTP/3 yourself.

The effect on performance depends on the site, the network and the number of files; the performance signals Google takes into account are discussed in our article on HTTPS, HSTS and security headers.

Further reading

  • Article HTTPS, HSTS and security headers: what Google really takes into account

Sources

  1. RFC 9113: HTTP/2 (external link, opens in a new tab)
  2. RFC 9114: HTTP/3 (external link, opens in a new tab)
  3. RFC 9000: QUIC, A UDP-Based Multiplexed and Secure Transport (external link, opens in a new tab)
  4. Apache HTTP Server: HTTP/2 guide (external link, opens in a new tab)

All definitions

Start free, go Pro when you’re ready

The free version already hides WordPress and moves the login page. Pro adds aliases, two-factor authentication and monitoring.