Custom HTTP headers

Prev Next

In some situations, you may want Autify Nexus to send custom HTTP headers when accessing your application under test. This can be helpful in situations like:

  • Skipping A/B testing or canary deployments

  • Forcing the website to use a specific language (e.g., via the Accept-Language header)

  • Sending a secret key required for access

How to set it up

Add a Playwright code step before the first “Navigate” step in your scenario, as shown below:

await context.setExtraHTTPHeaders({
  "[header name]": "[header value]",
});

Replace [header name] with the name of your header (e.g., X-My-App-Setting). Replace [header value]  with the value you want to send.

You can include multiple headers by adding more lines inside the { … }  block, for example:

await context.setExtraHTTPHeaders({
  "X-My-App-Setting": "value1",
  "Accept-Language": "en-US",
});