Which HTTP headers browsers won't let an extension change
Far fewer than the "forbidden header" lists suggest. Those lists limit page JavaScript, not extensions. In Chrome 159 and Firefox 158, HeaderDial's declarativeNetRequest rules set and removed Sec-Fetch-Site, Sec-Fetch-Mode, Sec-Fetch-Dest, Sec-Fetch-User, the Sec-CH-UA client hints, Origin, Referer, User-Agent and Accept-Encoding, and could set Cookie and even Host. What did not work: removing Host (both browsers), removing Connection (Chrome) or Priority (Firefox), and changing Content-Length or Transfer-Encoding, which broke the request. On responses, Firefox would not replace an existing Content-Type or Strict-Transport-Security value.
Page JavaScript versus an extension
The Fetch standard lists request headers a page's fetch() or XHR may not set: Host, Content-Length, Connection, Cookie, Origin, Referer, anything starting with Sec- or Proxy-, and more. We sent all of these from a page's fetch(). Both browsers dropped every one of them, so the server received the browser's own values. The exception was User-Agent: Firefox sent the page's value and Chrome did not. A custom header such as X-Custom went through in both.
Extensions are not bound by that list. Chrome documents the ModifyHeaderInfo rules it accepts, and MDN describes Firefox's implementation. Neither page lists the headers that are ignored after a rule has been accepted, which is why we measured it.
Request headers, measured
We checked this with HeaderDial 0.3.0 in Chrome 159.0.8154.6 and Firefox 158.0.1 in November 2026. For each header we added one rule (set to a recognisable value, or remove), loaded a page and sent a fetch() POST, and compared what a local HTTP/1.1 test server received with a run without rules. Edge uses Chrome's engine, but we did not test it separately.
| Header | Set | Remove |
|---|---|---|
Sec-Fetch-Site, Sec-Fetch-Mode, Sec-Fetch-Dest, Sec-Fetch-User | works in both | works in both |
Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform | works in both (Firefox does not send them by itself, but sends them when set) | works in Chrome; nothing to remove in Firefox |
Other Sec- names, such as Sec-Purpose | works in both | not sent by default |
Origin, Referer, User-Agent, Accept, Accept-Encoding, Accept-Language, Content-Type, Upgrade-Insecure-Requests | works in both | works in both |
Cookie | works in both | our test profile had no cookies; see Cookie and Set-Cookie |
Authorization, Proxy-Authorization, Cache-Control, Pragma, DNT, Date, Via | works in both | not sent by default |
Priority | works in both | Firefox still sent it; Chrome did not send it over HTTP/1.1 in the first place |
Host | works in both: the server received the new name, and the connection still went to the real address | no effect in either browser |
Connection | works in both (we tried close) | no effect in Chrome; removed in Firefox |
Keep-Alive, TE, Trailer, Upgrade, Expect | sent as set in both; the requests still succeeded | not sent by default |
Content-Length | broke requests: in Chrome every request failed, even with the correct length; in Firefox requests failed unless the value matched the body | no effect in Chrome; in Firefox the POST went out without it, the server read no body, and the request failed |
Transfer-Encoding | broke the request in both | not sent by default |
None of these rules was rejected when it was added. The browser accepted the rule and then sent, ignored or broke the header as shown.
What the API accepts
Some rules are refused when the extension adds them. We called declarativeNetRequest.updateSessionRules directly to see where the two browsers differ:
| Rule | Chrome 159 | Firefox 158 |
|---|---|---|
append to a request header such as X-Custom | rejected ("Only standard HTTP request headers that can specify multiple values for a single entry are supported") | accepted |
append to Accept-Language, or to any response header | accepted | accepted |
| set with an empty value | accepted | rejected ("value is required for operations append/set") |
| Header name with a space in it | rejected | accepted |
set Host | accepted | accepted |
HeaderDial turns append into set for request headers outside Chrome's list, with a message saying so, and refuses invalid names before the browser sees them. In Firefox, a set row with an empty value would make the browser reject the profile's whole rule. Since HeaderDial 0.3.1 that row alone is skipped, with a message under the editor, and the profile's other headers still apply (checked in Firefox 158.0.1). Fill in a value or switch the row to remove.
Response headers, measured
Here we set or removed each header on a response and read what a fetch() on the page saw, or followed the redirect:
| Header | Chrome 159 | Firefox 158 |
|---|---|---|
Server, Date, a custom header | set and remove work | set and remove work |
X-Frame-Options, Content-Security-Policy, Cache-Control, Access-Control-Allow-Origin, Referrer-Policy, Content-Disposition | set works (we did not test remove here) | set works |
Content-Type | set and remove work | set over an existing value: fetch() still reported the server's type, but navigations and scripts used the new one (see the Content-Type guide) |
Strict-Transport-Security | set and remove work | remove works; set over an existing value had no effect (see the HSTS guide) |
X-Content-Type-Options | set and remove work, including for script blocking | the page saw the change, but script blocking followed the server's value |
Location on a 302 | the browser followed the rewritten target | the browser followed the rewritten target |
Content-Length set to a wrong value | the page saw the new value; the body was still complete | no visible change |
Content-Encoding: gzip on an uncompressed body | fetch() failed | no visible change |
Set-Cookie is never readable from page JavaScript, so it needs a different test; see Cookie and Set-Cookie.
Steps: test a header yourself
- Click the HeaderDial icon. If the site-access banner appears, choose Allow on all sites or Only <current host>.
- Click + Request header (or + Response header), type the header name and a value you will recognise in a log, such as
hd-test. Or choose remove. - Open Where it applies, click + Only on…, choose Domain and enter a host whose logs you can read. A broken
Content-Lengthrule on all sites breaks every form post. - If the browser refuses the rule, the reason appears in the problems list under the profile.
- Load a page and look at what the server logged, or at an endpoint that echoes request headers. The DevTools Network panel shows what the browser meant to send. A server log shows what actually arrived.
The curl equivalent
Outside a browser nothing is forbidden, which is the main reason a server must not trust any of these headers:
curl -H "Host: admin.internal" http://203.0.113.10/
curl -H "Sec-Fetch-Site: same-origin" -H "Origin: https://app.example.com" -X POST https://app.example.com/api/transfer
Pitfalls
Sec-Fetch-*) and Origin protect users from other websites. A cross-site attacker cannot change them in a victim's browser. The user can, with an extension or curl, so they are no defence against the user. Never treat them as authentication.- HTTP/2 and HTTP/3 were not tested. We measured over HTTP/1.1. In HTTP/2,
Hostgives way to the:authoritypseudo-header and connection-specific headers such asConnectionandTransfer-Encodingare not allowed (RFC 9113), so results there may differ. - Removing is not the same as an empty value. Use remove to send no header. In Firefox an empty set is refused anyway.
- Some removals are silently ignored. For
Host,Connectionin Chrome andPriorityin Firefox, the rule was accepted and the browser sent its own value anyway. Check the server log rather than assuming a remove worked. - Switch it off afterwards. Give the row an expiry such as 15 min, or press Alt+Shift+D to pause every profile.
Add to ChromeFirefox: coming soon