Learning objectives
After reading this article you will be able to:
- Understand what QUIC changes compared with TCP and HTTP/2
- Learn how a browser discovers that a site speaks HTTP/3
- Check and enable HTTP/3 and know the protocol's limits
When you open a site behind a CDN, the page may have arrived over HTTP/3 with nothing to show for it. The URL is the same, the app's code is the same, and the only sign is an h3 in a DevTools column that is hidden by default.
The change happens below HTTP: TCP goes out and QUIC comes in. Understanding that swap explains why sites get faster on mobile networks and why some firewalls push the browser back to HTTP/2.
What is HTTP/3?#
HTTP/3 is the third major version of HTTP, defined in RFC 9114, which carries the same semantics (methods, status codes, headers) over QUIC instead of TCP. QUIC, from RFC 9000, is a general-purpose transport protocol that runs over UDP and has the TLS 1.3 handshake built in.
UDP on its own only delivers datagrams: no connection, no ordering, no retransmission. QUIC rebuilds on top of it what TCP provides (reliable delivery, congestion control) and adds what TCP lacks, such as many independent streams on one connection and mandatory encryption. RFC 9000 explains the choice: UDP datagrams pass through the systems and networks that already exist, which makes deployment easier.
| HTTP/1.1 | HTTP/2 | HTTP/3 | |
|---|---|---|---|
| Transport | TCP | TCP | QUIC over UDP |
| Requests per connection | One at a time (the browser opens several connections) | Many, multiplexed | Many, on independent streams |
| Effect of one lost packet | Stalls the request on that connection | Stalls every request on the connection | Stalls only the affected stream |
| Header compression | None | HPACK | QPACK |
| Encryption | TLS as a separate layer | TLS as a separate layer | TLS 1.3 inside QUIC, always on |
| Round trips on a new connection (with TLS 1.3) | 2 | 2 | 1 |
What HTTP/2 problem does HTTP/3 solve?#
HTTP/2 replaced HTTP/1.1's many parallel connections with multiplexing: many requests, called streams, share a single connection.
The catch is that TCP doesn't know streams exist. It delivers a single stream of bytes, in order. If a packet is lost, everything after it waits for the retransmission, including data from other requests that arrived intact. RFC 9114 describes the effect: a lost or reordered packet stalls all active transactions. That's head-of-line blocking at the transport layer.
QUIC knows about streams. It guarantees delivery on each stream separately and runs congestion control across the whole connection. A loss only delays the stream the packet belonged to; the others keep going. On a mobile network that drops packets, the page stops freezing as a whole on every loss.
Header compression changed too. HPACK, from HTTP/2, depends on in-order delivery, which QUIC doesn't guarantee across streams. HTTP/3 uses QPACK (RFC 9204), designed to work even when streams arrive out of order.
How does QUIC shorten the handshake?#
On a new TCP connection with TLS 1.3, the browser waits two round trips before sending the first byte of HTTP: one for the TCP handshake, another for TLS. With TLS 1.2, it's three. QUIC runs the transport and cryptographic handshakes together, so the first request goes out after a single round trip. For a client 150 ms round trip away from the server (an example figure), that's 150 ms off every new connection, and the higher the latency, the bigger the gain.
When the client has talked to the server before, QUIC goes further: it can send data in the very first packet, without waiting for the handshake. That's 0-RTT. The price is replay risk: anyone who captures that first packet can resend it, and the request runs twice. RFC 9001 says disabling 0-RTT is the most effective defense. RFC 8470 defines how HTTP handles the risk: the server can defer processing until the handshake completes or answer 425 Too Early, and an intermediary forwarding those requests marks them with Early-Data: 1. In practice, only requests without side effects, or idempotent ones, should be processed in 0-RTT.
What is connection migration?#
A TCP connection is identified by four values: the IP and port on each side. When a phone switches from Wi-Fi to mobile data, the client's IP changes and the connection dies. The browser opens a new one, with a new handshake.
QUIC identifies the connection by connection IDs, which don't depend on addresses. When the client's IP or port changes, the same connection carries on over the new path. RFC 9000 limits migration to new client addresses, and the client always starts it; at most, the server names a preferred address during the handshake. The same mechanism helps when a NAT router changes the client's port without warning.
How does the browser discover that a site speaks HTTP/3?#
The browser has no way to guess whether the server listens for QUIC on a UDP port. So the first connection usually goes over TCP, and the server advertises HTTP/3 in its response with the Alt-Svc header, from RFC 7838:
Alt-Svc: h3=":443"; ma=86400h3 is the HTTP/3 identifier in protocol negotiation (ALPN), ":443" is the UDP port on the same host and ma says for how many seconds the information is valid. Without ma, it's valid for 24 hours. On the next connections, the browser tries QUIC.
The second way is an HTTPS-type DNS record, from RFC 9460. A browser that looks up this record before connecting knows about HTTP/3 on the very first visit:
example.com. 3600 IN HTTPS 1 . alpn=h3,h2If the QUIC connection fails, for example because the network blocks UDP, RFC 9114 asks the client to fall back to HTTP over TCP. The site keeps working; it just loses the HTTP/3 gains.
How do you enable and check HTTP/3?#
In most cases, the app doesn't speak HTTP/3. The CDN or the reverse proxy in front of it does: it terminates QUIC and TLS and forwards the request over HTTP/1.1 or HTTP/2 on the internal network. The app's code doesn't change.
If you run your own proxy:
- Caddy: HTTP/3 is on by default. The default of the
protocolsoption ish1 h2 h3. - nginx: support comes from the
ngx_http_v3_modulemodule, which must be built with--with-http_v3_module. Check the module documentation for the state of the support and the TLS library requirements.
A minimal nginx configuration, with the app listening on 127.0.0.1:3000:
server {
listen 443 quic reuseport;
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/ssl/example.com.crt;
ssl_certificate_key /etc/ssl/example.com.key;
location / {
add_header Alt-Svc 'h3=":443"; ma=86400';
proxy_pass http://127.0.0.1:3000;
}
}listen ... quic opens the UDP port, and add_header Alt-Svc advertises HTTP/3 on the TCP responses. Also allow UDP 443 in the firewall, on top of TCP 443; without it, the browser tries, fails and falls back to HTTP/2.
To check, open the DevTools Network tab, right-click the table header and turn on the Protocol column. It shows h3 for HTTP/3, h2 for HTTP/2 and http/1.1. From the terminal:
curl -sI https://example.com/ | grep -i alt-svc
curl -sI --http3-only https://example.com/The first command shows whether the server advertises HTTP/3. The second forces HTTP/3, with no fallback, and the response starts with HTTP/3 200. It only works if your curl was built with HTTP/3 support: check that HTTP3 appears on the Features line of curl -V.
What are the limits of HTTP/3?#
- Blocked UDP. Corporate networks and firewalls that block or throttle UDP keep users on TCP, with no gain at all.
- 0-RTT replay. Turned on carelessly, it lets requests that change data be repeated.
- Less visibility on the network. QUIC also encrypts packet numbers and transport information, such as acknowledgments and flow control, which travel in the clear in TCP. Tools like tcpdump, and firewalls that inspect TCP, see less than they're used to.
- It doesn't speed up a slow server. If your app takes 800 ms to build the response, the protocol won't change that. Measure where the time goes with p50, p95 and p99 and see the effect on users in Core Web Vitals.
- Small gain on a good network. Between services in the same datacenter, with low latency and almost no loss, HTTP/2 or HTTP/1.1 work fine.
HTTP/3 doesn't replace TLS either: it requires it. Certificates and the handshake are explained in what is SSL/TLS.
How to do this on Square Cloud#
The Square Cloud network has HTTP/3, with no configuration in your app. Web traffic goes through an Anycast CDN with more than 200 points of presence, and that network is what offers HTTP/3 to the browser. Your web app keeps listening on 0.0.0.0 on the port in the PORT variable and receiving traffic on port 80, and TLS is automatic: there is no UDP port or certificate to configure.
Every published web app gets a *.squareweb.app subdomain with HTTPS and, from the Standard plan, you can use a custom domain.
To check on your subdomain, open the DevTools Network tab with the Protocol column on: requests that used HTTP/3 show up as h3, and the first visit may come over h2 while the browser discovers HTTP/3. See the network and CDN details.
Network
Custom domains, automatic TLS and a global CDN for your app
FAQs
Is HTTP/3 faster than HTTP/2?
It usually is on networks with packet loss and high latency, such as mobile ones, because a loss doesn't stall the other requests and the connection starts with fewer round trips. On a stable, fast network, the difference can be small.
Do I need to change my app's code to use HTTP/3?
Usually not. HTTP/3 typically terminates at the CDN or reverse proxy, which talks to your app over HTTP/1.1 or HTTP/2. HTTP semantics don't change, so routes, headers and status codes stay the same.
What happens if the network blocks UDP?
The browser can't open the QUIC connection and uses HTTP/2 or HTTP/1.1 over TCP. RFC 9114 asks for that fallback, so the site keeps working, just without the HTTP/3 gains.
Which port does HTTP/3 use?
Usually 443, but over UDP rather than TCP. The server can advertise a different port in the Alt-Svc header, and the firewall must allow UDP on that port.
More in Networking and domains
See all 31 articles- What is a load balancer and how does it work?A load balancer spreads incoming requests across several servers. Learn how it works, the main algorithms, layer 4 vs 7, and a working nginx example.
- DNS records explained: A, CNAME, MX, TXTDNS records are the instructions in a zone that tell the internet where a name points. Learn A, AAAA, CNAME, MX, TXT, NS and CAA with examples and dig commands.
- How to point a domain to your server or appTo point a domain to your server or app, create a CNAME (or A) record in your registrar's DNS panel. Steps, how to test it, and common mistakes.
- ERR_TOO_MANY_REDIRECTS: redirect loops explainedERR_TOO_MANY_REDIRECTS is a redirect loop, most often an app forcing HTTPS behind a proxy. Learn how to trace the chain with curl and fix each cause.