The HTTP Alt-Svc response header is used to indicate an alternate network location that can be relied upon for future HTTP requests.
The Alt-Svc header is sent by a server to instruct the client that an alternative service can be utilized for future HTTP requests. This is done to improve traffic manageability and efficiency.
Alternative services are not visible to the end-user and do not affect the URL.
clear directive is a request by the server to invalidate any previously-specified alternative services.
protocol-id refers to the ALPN protocol identifier, and a list of these is maintained by IANA. Common examples include HTTP/1.1 and h2 (for HTTP/2 over TLS).
alt-authority is a quoted string that refers to the alternative service. It includes an option override for the host, followed by a colon, and then the required port.
ma (max-age) is an optional parameter that indicates the number of seconds that the alternate service are considered to be fresh. After this time expires, the client is no longer allowed to make new connections to the alternative service. If the
ma directive is not included then 24 hours is assumed.
persist=1 directive instructs the client to maintain a cached alternative service if the network configuration changes. Normally, alternative services are cleared in such cases.
In the first example, the server tells the client to use a specific URL with port 443, and the ma is assumed to be 24 hours. In the second example, the host is omitted and the age is set to two hours (7200 seconds).
Alt-Svc: h2=”secure.example.ai:443” Alt-Svc: h2=”:443”; ma=7200
The Alt-Svc response header is sent by the service to indicate an alternative service for future HTTP requests. These are time-limited and can be set to persist in the event of a change in network configuration.