How to add a custom request header in Chrome
For a one-off HTTP test, send the header with curl. To have Chrome attach it when you load a page or use a web app, apply a browser rule scoped to the site you’re testing.
Send one request with curl
- Find the URL you want to test. If the app makes the request, open Chrome DevTools, select Network, and repeat the action that makes the request. Select the request and find its URL under Headers.
- For a GET on a test endpoint you control, run
curl --header 'X-Test-Mode: preview' https://staging.example.com/api/status. Replace the example URL, header name, and value with yours. - Read the response in your terminal. To test the full flow in Chrome, set up a rule below.
Apply the header in Chrome with KeenKit Headers
KeenKit Headers is available from the Chrome Web Store and Microsoft Edge Add-ons. Add to Chrome Get it for Edge
- Open KeenKit Headers from the toolbar and open the full editor. Create a profile for your test.
- Under Destination scope, choose One exact HTTPS origin and enter the site you’re testing. If the header should reach only some paths, choose Selected sites with URL filters instead and add a filter. Under request headers, choose Set and enter the header name and value.
- Include the request types you want, such as page loads or fetch requests. Select Apply and review the site access Chrome asks for.
- Repeat the request with DevTools open. In Network, select the matching request and look for your name and value under Request Headers. Pause the profile from the toolbar when you finish testing.
Profiles are stored in your browser. Chrome sends the configured value to matching destinations. Credentials require one exact destination. Setting values over plain HTTP requires approval for one exact local or private development origin. The source code is public under the MIT license: github.com/keenkit/headers. Permissions and scope · Privacy policy