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, like h2.
  • <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:

  1. Install the ModHeader extension from the Chrome Web Store.
  2. Click on the ModHeader icon in the top-right corner of your browser to open the extension.
  3. In the Response Headers section, click on Add button.
  4. In the Name field, enter Alt-Svc.
  5. In the Value field, enter the value of the header. For instance, h2="http2.example.com:8000"; ma=3600
  6. 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.