Alt-Svc and HTTP/3 negotiation
Advertisement is not negotiation
Alt-Svc tells a client that the same origin can be reached through an alternative service. With h3 and a port-only alternative, the host stays the same and the advertised alternative is UDP on that port. The client may store the advertisement and choose to attempt QUIC. It still must validate the server certificate for the origin. A header can be returned even if the UDP path is broken; successful HTTP/3 needs independent evidence.
add_header Alt-Svc 'h3=":9443"; ma=60' always;ma is the freshness lifetime in seconds. A short lab lifetime reduces stale discovery information. Clients need not switch immediately. An explicit Alt-Svc: clear can instruct clients that receive it to discard stored alternatives for this origin; removing the header alone is not instant invalidation.
Observe the actual protocol
log_format delivery 'status=$status protocol=$server_protocol h3=$http3';# server context:add_header X-Lab-Protocol $server_protocol always;Keep the log_format in http; the header belongs in server. $http3 is h3 on an HTTP/3 connection and empty on ordinary TCP HTTP. Read the actual client-reported HTTP version and matching lab log. Avoid logging sensitive query values and do not infer client-to-edge protocol from a backend connection.
curl --noproxy '*' --resolve localhost:9443:127.0.0.1 \ --cacert certs/server.crt --http3-only --max-time 8 \ -sS -o /dev/null -w '%{http_version} %{http_code}\n' \ https://localhost:9443/Expected version 3 and status 200 in the approved dual-listener lab. --http3-only prevents TCP fallback from making the test appear successful. Never replace --cacert with an insecure bypass. --http3 (without -only) permits earlier versions if QUIC cannot connect; it is useful for availability, not strict protocol proof.
Fallback and rollback
curl --noproxy '*' --resolve localhost:9443:127.0.0.1 \ --cacert certs/server.crt --http2 --max-time 8 \ -sS -o /dev/null -w '%{http_version} %{http_code}\n' \ https://localhost:9443/For a controlled fallback test, use the separate TCP-only configuration supplied in the lab after stopping the dual-listener instance. Strict HTTP/3 should fail, while --http3 should reach TCP when the client supports fallback. Test with a fresh client state and bound the deadline. No firewall changes are necessary. If a deployment must withdraw QUIC, stop advertising it, send clear where appropriate and retain verified TCP service while cached advertisements expire. Monitor actual version and error distributions; a single success is not a performance result.
Practice and next step
Compare advertised protocol, observed protocol and response status as three distinct facts. The lab test matrix includes failed UDP and certificate identity checks. Next: browser caching and cache-control headers. All live protocol tests remain staged.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Alt-Svc and HTTP/3 negotiation
Advertise an HTTP/3 alternative, verify the negotiated version, and test fallback without weakening TLS.
An Alt-Svc h3 advertisement proves what?
Which curl option disallows fallback?
What does $http3 contain on an ordinary HTTP/2 request?
What is ma=60 in Alt-Svc?
How should a lab certificate be trusted?