Alt-Svc

The Alt-Svc ( Alternative Service ) a header in HTTP defines that, when an origin has resources that are accessible through a different protocol/host/port combination, it is said to have an alternative service available.

Description

An alternative service can be used to interact with the resources on an origin server at a separate location on the network, possibly using a different protocol configuration. Alternative services are considered authoritative for an origin's resources. like ( response data etc )
but you have to over TLS ( Transport Layer Security ) based connection to access these resources and the same certificate can be used for Alternative Services.

Note:- h2c protocol never be used as an Alternative Service because h2c never used over TLS based connection.

For example as client request for the resource in alternative services [uri-host]

   ("http", "www.example.com", "80")
resources are also accessible at the alternative service:
("h2", "new.example.com", "81")

Syntax

Alt-Svc: clear
Alt-Svc: <service-list>; ma=<max-age>
Alt-Svc: <service-list>; ma=<max-age>; persist=1
clear
A field value the special value ''clear" indicates that the origin requests all alternatives for that origin to be invalidated (including those specified in the same response. ( clear as string only )
<service-list>
A comma-separated list of service definitions in the format of <service-name>=​"<host-name>:<port-number>", where <service-name> is a valid ALPN identifier. ( ex: h2="www.example.com"; , h2="h2:port"; )

note: h2=": port" means alternative service on the same origin with different port
<max-age>
The delta -seconds values indicate the number of seconds since the response was generated for which the alternative service is considered fresh. (ex: ma=60 )
persistOptional
Optional parameter specifying that the alternative service can be remembered between sessions and network changes.( ex= persist=1 )

Example

Alt-Svc: h2=":443"; ma=2592000;
Alt-Svc: h2=":443"; ma=2592000; persist=1

Specifications

Specification Status Comment
RFC 7838 IETF RFC Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Alt-SvcChrome Full support YesEdge ? Firefox Full support 38
Full support 38
No support 37 — 38
Notes
Notes Only supports draft-04
No support 35 — 37
Notes Disabled
Notes Only supports draft-03
Disabled From version 35 until version 37 (exclusive): this feature is behind the network.http.altsvc.enabled preference (needs to be set to true) and the altsvc.oe preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE ? Opera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 38
Full support 38
No support 37 — 38
Notes
Notes Only supports draft-04
No support 35 — 37
Notes Disabled
Notes Only supports draft-03
Disabled From version 35 until version 37 (exclusive): this feature is behind the network.http.altsvc.enabled preference (needs to be set to true) and the altsvc.oe preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

See also