Custom headers allow you to tailor your requests by adding specific HTTP headers to the request. These headers can include standard fields like AcceptCookie and Referer. Adjusting these headers allows you to control content types, manage session cookies, and handle other use cases.

However, it’s important to note that ZenRows® automatically manages certain headers, especially those related to the browser environment, such as User-Agent. This ensures the highest possible success rate and consistent performance across requests. To maintain these standards, customization of these specific headers is not allowed by default.

Important Considerations

  1. Header Format: When adding custom headers, use the format Header: Value without quotes. Ensure that each header is properly formatted to avoid issues with the request.

  2. Managed Headers: ZenRows automatically handles certain browser-based headers, such as Client-Hints, Accept-Encoding, and other headers that could be used for.

  3. Forbidden Custom Headers: Customers are not allowed to set browser-based headers manually. This includes but is not limited to:

  • Sec-Ch-Ua (Client Hints)
  • Accept-Encoding
  • Sec-Fetch-Mode
  • Sec-Fetch-Site
  • Sec-Fetch-User

ZenRows manages these headers, and you can’t override them.

Enabling Custom Headers

For headers that are allowed, you must set the custom_headers parameter to true in your request. This tells ZenRows to include your custom headers while managing critical browser-based headers.

If you need to use custom headers and are unsure which ones are allowed or are facing challenges with the headers you’re trying to set, please contact us for guidance.

Frequently Asked Questions (FAQ)