alt-svc
Tells the browser to load the content from another server, without doing a redirect.
The alt-svc HTTP header is a way for the server to tell the web browser that it can load this and future content from another source, without indicating to the user that this is happening. This is usually used to upgrade the HTTP networking protocol. For example, if the browser made an HTTP/1.1 request, the alt-svc header can tell the web browser to silently load content via HTTP/2 or HTTP/3 instead.
Example:Alt-Svc: h2=":443"; ma=6040800;
The example above tells the browser that it can reconnect to port 443 on the same host and use the HTTP/2 protocol for future requests and it can keep doing this for 1 week (6040800 seconds). This is a convenient way for the server to tell the client its preferred way of communication, without affecting the current request or adding any extra steps.
The first part of the header should indicate the new protocol to use. Values for this include h2
and h3
. Then there should be an equals sign and a quoted string which indicates the alternative source, or the portion that should be overridden on the current host. For example, h2="cdn.example.com:5555"
would tell the browser to use port 5555 on another server to fetch the content instead.
This is all that is required, but there are some optional values that can be supplied to customize how this information should be cached. By default, the information will be cached and used for 24 hours, but the ma=[age in seconds]
value can be included to make it expire at a different time.
Ready to validate your website to check for this header and 100+ others important tests?