files/en-us/web/http/reference/headers/critical-ch/index.md
{{SeeCompatTable}}{{SecureContext_Header}}
The HTTP Critical-CH {{Glossary("response header")}} is used along with {{HTTPHeader("Accept-CH")}} to identify the accepted client hints that are critical.
User agents receiving a response with Critical-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 the Critical-CH header should also be present in the Accept-CH and Vary headers.
Critical-CH: <ch-list>
<ch-list>
The client makes an initial request to the server:
GET / HTTP/1.1
Host: example.com
The server responds, indicating via {{HTTPHeader("Accept-CH")}} that it accepts {{HTTPHeader("Sec-CH-Prefers-Reduced-Motion")}}. In this example, Critical-CH is also used to specify that Sec-CH-Prefers-Reduced-Motion is considered a critical client hint.
HTTP/1.1 200 OK
Content-Type: text/html
Accept-CH: Sec-CH-Prefers-Reduced-Motion
Vary: Sec-CH-Prefers-Reduced-Motion
Critical-CH: Sec-CH-Prefers-Reduced-Motion
[!NOTE] We've specified
Sec-CH-Prefers-Reduced-Motionin the {{HTTPHeader("Vary")}} 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-CHheader should also be present in theAccept-CHandVaryheaders.
The client automatically retries the request (due to Critical-CH being specified above), telling the server via Sec-CH-Prefers-Reduced-Motion that it has a user preference for reduced-motion animations:
GET / HTTP/1.1
Host: example.com
Sec-CH-Prefers-Reduced-Motion: "reduce"
The client will include the header in subsequent requests in the current session unless the Accept-CH changes in responses to indicate that it is no longer supported by the server.
{{Specifications}}
{{Compat}}