Alt-Svc Header
Table of Content
The Alt-Svc
HTTP response header is used to tell the client that services are available on a different server or at a different network location. This is particularly useful for HTTP/2 server push techniques where better performance might be available through a different protocol or a different port on the same machine.
Syntax
Alt-Svc: <protocol>="<host>:<port>"; ma=<max-age>[; persist]
Directives
<protocol>
- The alternative protocol to use, likeh2
.<host>:<port>
- The location of the server providing the specified protocol.ma=<max-age>
- The time in seconds the client should use this alternative service.persist
- Indicates that the client should use this alternative service beyond the max-age lifetime.
Examples
This example informs the client that an HTTP/2 based alternative service is available on h2.example.com:8000
Alt-Svc: h2="h2.example.com:8000"; ma=3600
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Not Supported |
Opera | Supported |
Edge | Supported |
How to modify Alt-Svc header
ModHeader is a Chrome extension that can be used to modify HTTP response headers.
To modify the Alt-Svc
header using ModHeader, follow these steps:
- Install the ModHeader extension from the Chrome Web Store.
- Click on the ModHeader icon in the top-right corner of your browser to open the extension.
- In the
Response Headers
section, click onAdd
button. - In the
Name
field, enterAlt-Svc
. - In the
Value
field, enter the value of the header. For instance,h2="http2.example.com:8000"; ma=3600
- Save the changes.
Please note that this will only simulate modifying the Alt-Svc
header for the specific browser. Other clients accessing the same service will not see this modification. It's just a tool for developers to easily test how their application would react to different server responses.