HTTP Alt-Svc & Upgrade Reference

Alt-Svc, Upgrade, HTTP2-Settings headers with protocol negotiation flow.

Reference for HTTP protocol-upgrade headers including Upgrade, Alt-Svc, ALPN and 101 Switching Protocols, plus a live Alt-Svc parser that splits entries into protocol, authority and max-age.

What does the Alt-Svc header do?

Alt-Svc advertises alternative endpoints or protocols that serve the same origin — typically HTTP/3 over QUIC. The client may switch to the advertised service on its next request and remember it for the ma (max-age) duration, defaulting to 24 hours.

Switching protocols mid-connection

Modern HTTP can negotiate a better protocol — HTTP/2, HTTP/3 or WebSocket — after a connection starts. The Upgrade mechanism switches the current connection in place and returns 101 Switching Protocols, while Alt-Svc points the client at an alternative endpoint to use on future requests. This reference covers those headers plus the TLS ALPN extension that actually drives h2/h3 selection in browsers, with a parser for any Alt-Svc value.

How it works

An Alt-Svc value is a comma-separated list of alternative services, each with a protocol id, an authority and optional parameters:

Alt-Svc: h3=":443"; ma=86400; persist=1, h2="alt.example.com:443"; ma=3600

Here h3 (HTTP/3 over QUIC) is offered on port 443 of the same host for one day and persisted across network changes, while h2 points to a different host. The parser splits each entry and reads its ma (max-age) and persist flag. The classic Upgrade flow is different — it is hop-by-hop and switches the live connection:

GET /chat HTTP/1.1
Connection: Upgrade
Upgrade: websocket
→ HTTP/1.1 101 Switching Protocols

In browsers, HTTP/2 and HTTP/3 are chosen during the TLS handshake via ALPN, so Upgrade survives mainly for WebSocket and Alt-Svc for steering to QUIC.

Tips and notes

  • Connection: Upgrade must accompany Upgrade, or proxies will forward it incorrectly.
  • An empty host in Alt-Svc (h3=":443") means the same host on that port.
  • ma defaults to 24 hours; persist=1 keeps the alternative across network changes.
  • Cleartext h2c upgrades are unused on the web — rely on ALPN and Alt-Svc.