Guide
How to modify request headers in Chrome
Chrome has no setting for this, so you need an extension. In Headerbench you create a profile with the header rows, limit it to the sites you test, and turn it on. Chrome then adds the headers to page loads, fetch, XHR and POST requests on those sites.
Add a request header in Headerbench
- Install Headerbench in Chrome or Edge. On the welcome page, choose Start with a blank profile.
- Name the profile after what it does, for example API debug. On Request headers, click Add a request header.
- Type the header name, for example
X-Debug, leave the action on Set and enter the value1. Press Enter to add another row. - Open Filters and add an include filter of type Domain with
api.example.com. It matches that host and its subdomains. With no include filter, the profile changes every site you visit. - Open the page you are testing, click the Headerbench icon and turn the profile on. Accept Chrome’s prompt for the profile’s sites and for the page.
- Reload the page. Applied on this tab in the popup lists each header against the requests it matched.
Example: a debug profile
This profile flags API calls for verbose logging, tags them with a request id, adds French to the language list and drops cookies to test a logged-out response:
Profile API debug
Request headers
Set X-Debug 1
Set X-Request-Id hb-local-test
Append Accept-Language fr-FR
Remove Cookie
Filters
Include Domain api.example.com
Set, append or remove
- Set adds the header, or replaces the value the browser or the page sent.
- Append adds your value to the existing one.
- Remove deletes the header from the request.
Append works only on the request headers Chrome allows it for, such as
Accept, Accept-Language, Cache-Control,
Cookie, Forwarded, User-Agent, Via and
X-Forwarded-For. For any other header, Headerbench sends Set instead and
shows a warning on the row.
Within one profile, the first row that sets or removes a header wins and later rows for the same name are flagged. When two profiles that are on set the same header, the one higher in the list wins; Test a URL shows which.
Check that it worked
-
Add
httpbin.orgas a second include filter and open httpbin.org/headers. It returns the request headers the server received, as JSON. - In the editor, Test a URL takes a URL, request type and method and lists every rule that would apply, and why one would not.
- The popup’s Applied on this tab shows what Chrome changed on the tab.
{
"headers": {
"Host": "httpbin.org",
"X-Debug": "1",
"X-Request-Id": "hb-local-test"
}
}
Chrome DevTools does not always show headers changed by an extension. If the Network panel shows the old value, trust the server’s echo or the popup’s Applied on this tab, which asks Chrome what it actually changed.
Troubleshooting: the header is not sent
Chrome needs access to the page too
Chrome applies header and redirect rules only when Headerbench has access to the request’s site
and to the page that sends the request, its initiator. A call to
api.example.com from an app on localhost:3000 needs both. Without the
page, Chrome skips the rule without an error. The popup shows a Grant button
when the current page is missing, and Test a URL has a
Sent from page field that checks the pair.
The filters do not match
A Domain filter matches the host and its subdomains, not a path. For a path, use a
URL pattern such as ||example.com/api/*. If you set
Request types to Only these: Fetch / XHR, page loads and scripts
are left alone. Test a URL tells you which filter failed.
Everything is paused, or the profile is tab-only
Alt+Shift+H pauses and resumes all profiles. A profile turned on for This tab only applies to that tab alone and is cleared when the browser restarts. A profile set to pause after 1 or 8 hours turns itself off.
The page is one Chrome protects
Extensions cannot change requests from chrome:// pages or the Chrome Web Store.
The popup says so on those tabs.
Without an extension
-
For a single request, use DevTools: in the Network panel, right-click the request, choose
Copy as cURL, add
-H 'X-Debug: 1'and run it in a terminal. This does not change what the page itself sends. -
In automated tests, Playwright’s
extraHTTPHeadersoption and Puppeteer’spage.setExtraHTTPHeaders()add headers to every request of that browser. - DevTools can override response headers and the User-Agent, but has no setting for other request headers.