How-To Guide

How to Advertise HTTP/3 with Alt-Svc

Offer HTTP/3 alongside HTTP/2 with the Alt-Svc header, using a compatible port, migration and fallback so clients upgrade safely.

On this page

  1. Introduction
  2. Why Advertise Rather Than Assume
  3. The Alt-Svc Header
  4. Port, Host and Origin Consistency
  5. Serving HTTP/3
  6. Connection Migration and 0-RTT
  7. Measuring and Rolling Out
  8. Common Pitfalls and Conclusion

Introduction

HTTP/3 runs over QUIC instead of TCP, which lets it avoid head-of-line blocking across streams and reduce connection setup on resumed connections. But clients cannot know a server speaks HTTP/3 unless they are told, and the first request typically arrives over TCP. The Alt-Svc header is how a server advertises that it also speaks HTTP/3: the client makes the first request over HTTP/2, sees the advertisement, and uses HTTP/3 for subsequent requests to the same origin.

Why Advertise Rather Than Assume

A client does not know in advance whether an origin supports QUIC. It starts with TCP (HTTP/2 or HTTP/1.1), and only if the response advertises an alternative will it try QUIC. This keeps compatibility: a client that cannot do QUIC still works over TCP, and a network that blocks UDP still gets the site over TCP.

The advertisement is a hint, not a requirement. The client may ignore it, may try and fail, and must fall back to TCP. That fallback is what makes the transition safe: enabling HTTP/3 does not break clients or networks that cannot use it.

This also means the advertisement is safe to deploy widely: a client that never learns of it loses nothing, and a client that learns of it but cannot use QUIC falls back seamlessly, so the protocol upgrade stays optional at every step.

# the Alt-Svc flow
1. client connects over TCP (HTTP/2)  -- first request
2. server responds with: Alt-Svc: h3=":443"; ma=86400
3. client tries QUIC on port 443 (h3 = HTTP/3)
4. if it works, subsequent requests use QUIC; if not, fall back to TCP
# the advertisement is a hint; TCP remains the safe fallback

The Alt-Svc Header

Alt-Svc lists alternative services for the origin: the protocol (h3 for HTTP/3), the host and port, and a max-age (ma) in seconds telling the client how long the advertisement is valid. A cleared value (clear) withdraws the advertisement. The client caches it and uses it for subsequent requests.

The host defaults to the origin’s host; you can advertise a different host, which is how a third-party CDN advertises its own QUIC endpoints. Most self-hosted setups advertise the same host and port, so the client just switches protocol, not destination.

# advertise HTTP/3 on the same host and port
Alt-Svc: h3=":443"; ma=86400
# ma = 86400 => the client may use this for 1 day
# withdraw the advertisement:
Alt-Svc: clear
# advertise on a different host (e.g. a CDN's QUIC endpoint):
Alt-Svc: h3="cdn.example:443"; ma=3600

Port, Host and Origin Consistency

The port in an Alt-Svc advertisement must match a port the server actually listens on for QUIC, almost always 443/UDP. Advertising a port with no QUIC listener makes every client try and fail, then fall back, which adds a wasted attempt to each connection.

The advertised host must serve the same origin with a valid certificate for it. An advertisement pointing at a host whose certificate does not cover the origin causes a TLS failure on the QUIC attempt, which the client treats as a failed alternate and falls back to TCP.

# port/host consistency
[ ] the advertised port has a real QUIC listener (typically 443/UDP)
[ ] the advertised host has a valid cert for the origin
[ ] advertising the same host+port just switches protocol (usual case)
# a mismatch => wasted QUIC attempt, then fall back to TCP

Serving HTTP/3

The server must actually implement QUIC and HTTP/3, not just advertise it. Reverse proxies and CDNs have HTTP/3 support; enable it on the listener and ensure UDP 443 is reachable, because many networks firewall UDP, especially on legacy paths. HTTPS/3 uses UDP, so a network that blocks UDP will never connect over it.

Because UDP may be blocked, the server must keep TCP listening and serving. The Alt-Svc advertisement never replaces TCP; it offers an alternative. Keep HTTP/2 enabled so a client that cannot use QUIC still gets a good connection.

# nginx with HTTP/3 (illustrative): enable QUIC on UDP :443
server {
  listen 443 quic reuseport;      # HTTP/3 over QUIC
  listen 443 ssl;                 # keep TCP (HTTP/2) as fallback
  http2 on;
  ssl_certificate     /etc/tls/site.crt;
  ssl_certificate_key /etc/tls/site.key;
  add_header Alt-Svc 'h3=":443"; ma=86400' always;  # advertise
  quic_retry on;
}

Connection Migration and 0-RTT

QUIC supports connection migration: a connection survives a change in the client’s network path, such as switching from Wi-Fi to cellular, because the connection is identified by a connection id rather than the address tuple. This is a benefit for mobile clients and a reason to prefer HTTP/3 where the client is mobile.

QUIC also supports 0-RTT resumption, letting a resumed connection send data in the first flight for a faster start. 0-RTT has replay considerations for non-idempotent requests, so servers often accept 0-RTT only for safe requests. Treat 0-RTT as an optimisation to enable deliberately.

# QUIC extras
connection migration   survives a client network change (Wi-Fi -> cellular)
                       (connection id, not address tuple)
0-RTT resumption      data in the first flight; faster start
                       replay risk => accept 0-RTT only for safe requests
# reasons to prefer h3 for mobile clients

Measuring and Rolling Out

Roll out gradually: serve HTTP/3 on a portion of traffic or an origin, watch the QUIC connection success rate and the fallback rate, and disable it if the failure rate is high. A high fallback rate means UDP is blocked or the QUIC endpoint is misconfigured.

Keep the Alt-Svc max-age moderate during rollout so a bad advertisement expires quickly, and be ready to send Alt-Svc: clear to withdraw it. Measure latency and error rates split by protocol, because HTTP/3 helps some paths and not others.

# rollout
[ ] enable h3 on a fraction of traffic / one origin first
[ ] measure QUIC success rate vs TCP fallback rate
[ ] keep ma moderate during rollout (fast expiry if bad)
[ ] be ready to send Alt-Svc: clear to withdraw
[ ] split latency/errors by protocol to confirm the benefit

Common Pitfalls and Conclusion

Do not advertise HTTP/3 without serving it; every client wastes an attempt. Do not remove TCP when enabling QUIC; TCP is the fallback. Do not advertise a port or host that is not QUIC-capable or whose certificate does not cover the origin. And do not assume HTTP/3 helps everywhere; some paths and networks see no benefit and a firewall may block UDP entirely.

Alt-Svc advertises HTTP/3 over QUIC while keeping TCP as the safe fallback: the client makes the first request over HTTP/2, sees the advertisement, and upgrades to QUIC if it works. Serve real HTTP/3 on a matching port and host, keep TCP serving, roll out gradually with metrics split by protocol, and withdraw the advertisement if it causes problems. Then clients get the QUIC benefits without breaking the ones that cannot use it.

Verify the upgrade with a request from a client that supports QUIC before rolling the advertisement out widely.

Sources: RFC 9114: HTTP/3, RFC 7838: HTTP Alternative Services, Cloudflare: HTTP/3 and Alt-Svc.

FAQ

Why does the first request still use TCP?
Because the client does not know the origin supports QUIC until it is told. It makes the first request over TCP, sees the Alt-Svc advertisement in the response, and uses HTTP/3 for subsequent requests. The advertisement is a hint, and TCP stays as the fallback.
What if UDP is blocked on the network?
The client tries QUIC, fails, and falls back to TCP, which still works because the server keeps listening on TCP. This is why HTTP/3 is advertised rather than required: a network that blocks UDP never breaks the site, it just does not get the QUIC benefit.

Related Examples