Critical-CH header
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
The HTTPCritical-CHresponse header is used along withAccept-CH to identify the acceptedclient hints that arecritical.
User agents receiving a response withCritical-CH must check if the indicated critical headers were sent in the original request. If not, the user agent will retry the request along with the critical headers rather than render the page. This approach ensures that client preferences set using critical client hints are always used, even if not included in the first request, or following server configuration changes.
Each header listed in theCritical-CH header should also be present in theAccept-CH andVary headers.
| Header type | Response header |
|---|
In this article
Syntax
Critical-CH: <ch-list>Directives
<ch-list>A list of one or more comma-delimited client hint headers that the server considers to be critical client hints.
Examples
The client makes an initial request to the server:
GET / HTTP/1.1Host: example.comThe server responds, indicating viaAccept-CH that it acceptsSec-CH-Prefers-Reduced-Motion. In this example,Critical-CH is also used to specify thatSec-CH-Prefers-Reduced-Motion is considered a critical client hint.
HTTP/1.1 200 OKContent-Type: text/htmlAccept-CH: Sec-CH-Prefers-Reduced-MotionVary: Sec-CH-Prefers-Reduced-MotionCritical-CH: Sec-CH-Prefers-Reduced-MotionNote:We've specifiedSec-CH-Prefers-Reduced-Motion in theVary header to indicate that responses should be separately cached based on the value of this header (even if the URL stays the same).Each header listed in theCritical-CH header should also be present in theAccept-CH andVary headers.
The client automatically retries the request (due toCritical-CH being specified above), telling the server viaSec-CH-Prefers-Reduced-Motion that it has a user preference for reduced-motion animations:
GET / HTTP/1.1Host: example.comSec-CH-Prefers-Reduced-Motion: "reduce"The client will include the header in subsequent requests in the current session unless theAccept-CH changes in responses to indicate that it is no longer supported by the server.
Specifications
| Specification |
|---|
| Client Hint Reliability> # name-the-critical-ch-response-he> |