🎉 Requestly joins BrowserStack to build the future of application testing. Read more

HTTP Headers

Accept CH

HTTP Header

The HTTP Accept-CH response header may be set by a server to specify which client hint headers should be included by the client in subsequent requests.
To ensure client hints are sent reliably, the Accept-CH header should be persisted for all secure requests.

Note: The Accept-CH header does not block any request headers and is not considered a forbidden request header. It also does not fall under the category of CORS-safelisted response headers.

Syntax


Accept-CH: <client-hints-headers>

// Client hint headers in a comma-separated list

Accept-CH: <ch-header-one>, <ch-header-two>

Example

Client hint response headers

The following response headers indicate that the server accepts Viewport-Width and Width device client hints in subsequent requests.
The Vary header indicates which values were used to vary the response based on the accepted client hints.

Accept-CH: Viewport-Width, Width
Vary: Viewport-Width, Width

How to Modify Header using Requestly

Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Accept header. This is especially useful for testing how your application responds to different media types during development or debugging. Steps to Modify the Accept Header:

  1. Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
  2. Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
  3. Add a new header modification:
    • Under “Action”, select “Add” or “Override”.
    • In the “Header Name” field, enter Accept.
    • In the “Header Value” field, enter your preferred media type (e.g., text/html).
  4. Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
  5. Save the rule.

Once set up, Requestly will inject the Accept: text/html header into all matching requests, allowing you to simulate different client behaviors and test content negotiation on your server.

You might need to modify the Accept header to see how your website or API handles requests for different types of content, like HTML, JSON, or XML. This helps ensure your app responds correctly to different clients and improves overall compatibility.