Guide · Chrome, December 2026
How to send an Authorization header to a staging API from Chrome
You are testing a front end against a staging or test API that wants a bearer token, an API key, or a header such as X-Env: staging. Your page does not send it, and you do not want to rebuild the page just to try something. Here is how to send the header from the browser, first for one request and then for every request to the domains you choose, and what to be careful about with a token.
1. One request: Edit and resend, or cURL
If you only need to see one answer, you do not need an extension. In DevTools, open the Network panel, right-click the request and choose Edit and resend as fetch; the Console opens with the request as a fetch() call. Add Authorization: Bearer YOUR_TEST_TOKEN to its headers and press Enter. Or use Copy > Copy as cURL, edit it in a terminal and run it. Our guide to changing headers in Chrome has the full steps.
The catch: that sends one request outside the page. The page itself, and everything it loads after that, still goes out without your header. If the page must send it on every call, go on to step 2.
2. A header profile for the staging domain
With a header-editing extension such as Header Switch, you keep the header in a named profile. For an API at api.staging.example.com:
- Create a profile and name it for the environment, for example "Staging API".
- Add a header with direction request, operation set, name
Authorizationand valueBearer YOUR_TEST_TOKEN. Use set rather than append: Chrome only allows append on a fixed list of standard request headers, such ascookieoruser-agent, andAuthorizationis not on it. - Add the second header if you need one, for example
X-Envwith the valuestaging. A value cannot be empty for set and cannot contain line breaks. - In the domain list, add the staging domain. Sub-domains are included, so
staging.example.comalso coversapi.staging.example.com.
The domain list is what keeps the header away from other sites. Header Switch treats an empty list as "all sites", so do not leave it empty when the header carries a token.
3. Grant access, and remember the page's own domain
Chrome only lets the extension change headers on sites you allow. After you save the profile, click Grant access to these domains and accept Chrome's prompt. Saving alone does not ask.
One thing catches people out: if your front end runs on localhost:3000 and calls the API on another domain, the request comes from a page on a different site. Header Switch's documentation says to allow that site too. If a profile is missing access, the popup and the Options page show a Grant access button and the icon badge shows !.
4. Check that the header arrives
- Make the request from your page, open the Network panel and look at the request. Chrome's DevTools show the headers the page set; headers added by an extension may be missing from that view, so do not rely on it alone.
- The reliable check is on the server: log the incoming headers, or point the profile at a test service that echoes headers, such as
httpbin.org, and openhttps://httpbin.org/headers. - A cross-origin call with an
Authorizationheader makes Chrome send a preflightOPTIONSrequest first. If the API answers a CORS error, the fix is on the API side; see our CORS guide. - Still missing? Our checklist for a header extension that is not working goes through access, rule order, cache and other extensions.
5. Switch environments, and pause
Make one profile per environment (staging, test, a customer sandbox), each with its own domain and its own token. The toolbar popup turns profiles on or off, and its On / Paused switch pauses all of them at once. When two profiles set the same header, the one higher in the list wins, so keep them in separate domains and you will not need to think about it. The icon badge shows how many headers are active.
Be careful with the token
- Use a test or staging token, ideally short-lived and with the least access. Do not put a production secret in a browser profile.
- Header Switch keeps profiles in the extension's local browser storage and does not send them to us. That storage belongs to your Chrome profile, so anyone who can use your signed-in browser can open the Options page and read the value. Do not share an exported profile file without removing the token first.
- Pause or delete the profile when you are done. A header you forgot about is a common reason for requests that behave differently on your machine.
- Rotate the token if it ever ends up in a screenshot, a shared export or a ticket.
When to add more
The one-off ways cost nothing. If you set the same headers every day, we make Header Switch, a Chrome extension built for this: profiles per environment, headers turned on or off one by one, domain limits, and Chrome's declarativeNetRequest engine so it never reads page content. The free plan applies 1 profile with up to 3 headers, enough for the example above. Paid plans, with unlimited profiles and several profiles at once, are not on sale yet.
We build Header Switch. Step 1 works without it. This guide was written with AI assistance. The extension details were checked against its code and documentation, not a live test of your API, and the DevTools steps against Chrome's documentation. DevTools menus can change between Chrome versions. The token values and domains above are placeholders.