Send a header only on requests made by one site
To add a header only when a request comes from pages on one site, use HeaderDial's Page domain filter (added in 0.6.0). Say your app runs on localhost:3000 and calls api.example.com. A rule with Only on → Page domain → localhost adds your test token to those calls. The same API opened in another tab, or used by another site, gets nothing. A plain Domain filter can't do this, because it looks at where the request goes, not which page sent it.
Domain vs Page domain
| Filter | Looks at | Example |
|---|---|---|
| Domain | The host the request is sent to | api.example.com: every request to the API, from any tab |
| Page domain | The site of the page that made the request (the browser calls it the initiator) | localhost: requests that pages on localhost make, to any host |
Use both in one profile to get "requests from my local app to the API only". The two filters must both match. Several Page domain filters in one profile mean "any of these sites".
Steps
- Open HeaderDial and click + Request header. Enter the name and value, for example
AuthorizationandBearer <test token>. - Open Where it applies and click + Only on…. In the second select choose Page domain and type the page's host, for example
localhostorapp.example.com. Leave out the port and thehttp://. - To limit the target too, add another + Only on… filter with Domain
api.example.com. - Give HeaderDial site access to both the API host and the page's host. In our CORS test, Chrome changed a call between two hosts only when HeaderDial had access to both. Access to just one of them changed nothing. The banner in the popup asks for access.
Use Never on → Page domain the other way round, for example to add a header everywhere except on requests made by your admin console.
What we measured
Measured with HeaderDial 0.6.0's end-to-end tests: a local echo server reachable as both localhost and 127.0.0.1, and a profile limited to Page domain localhost. Chrome 159.0.8154.6 and Firefox 158.0.1, 20 November 2026.
| Request | Chrome 159 | Firefox 158 |
|---|---|---|
fetch() from a page on localhost to 127.0.0.1 | header sent | header sent |
The same fetch() from a page on 127.0.0.1 | not sent | not sent |
| Typing the API URL in the address bar | not sent | not sent |
A navigation started by script on the localhost page (location.href = …) | header sent | not measured |
The typed address gets nothing because a request you type has no initiator page. Bookmarks and new tabs behave the same way. If you need the header on page loads you open yourself, use a Domain filter instead.
Things to know
- Subdomains are included. Per the browser's declarativeNetRequest documentation,
example.comalso matches pages onapp.example.com. To match only a subdomain, type it in full. - Frames count as their own page. According to the same documentation, the initiator is the origin of the frame that made the request. A request from an embedded iframe therefore counts as coming from the iframe's site, not the top page's.
- Redirects follow it too. A Page domain filter also limits the profile's URL redirects. A plain Only on URL filter does not, because a redirect carries its own URL match.
"Never on" no longer switches off your other profiles
The same release fixes a quieter problem. Browsers implement a "Never on" URL filter as an allow rule, and an allow rule switches off every lower-priority rule of the extension, not just its own profile's. Before 0.6.0, a "Never on */health*" filter in your top profile therefore also stopped the profiles below it on /health. HeaderDial now copies the lower profiles' header rules above the exclusion, limited to the excluded URLs. In both browsers above, the lower profile's headers now arrive on the excluded URL, and the upper profile still wins on other URLs. In one case the browser rules cannot express this: two active profiles that both have "Never on" URL filters. HeaderDial then shows a warning in the popup that names both profiles. Using a Domain exclusion in one of them avoids the problem.
Add to ChromeFirefox: coming soon