This extension, available for Firefox and Chrome, allows you to rewrite headers based on a rules table.
You can easily start and stop the extension using the button on the top right. Remember to click the save button to apply your modifications.
The extension also provides the ability to:
The rules table consists of the following parameters:
Action
: Specifies whether to add, modify, or delete a header field or cookie.Header Field Name
: The name of the header field or cookie.Header Field Value
: The value of the header field or cookie.Comment
: Any additional comments.Apply On
: Determines if the rule applies to request headers ("request") or response headers ("response").Status
: Indicates if the rule is active ("on") or inactive ("off").Export
: If set to "To export", the rule will be included when using the export function.We can choose the URLs on which the modifications are applied by modifying the URL pattern :
The parameters button permits to:
According to the version of Firefox, the addition of a new header behaves differently. In the latest version, when you choose the "add" action and the header exists, it appends the value, while in the old version, it replaces it. If you want to modify an exiting header, you should use "modify" instead of "add".
It's not possible to define a specific port number in url pattern, https://stackoverflow.com/questions/11425591/match-port-in-chrome-extension-pattern
The introduction of Manifest V3, mandatory on Chromium-based browsers starting approximately in june 2024, has imposed restrictions on header modifications (refer to Chromium Blog). Direct access to header and custom request filtering are no longer possible. All modifications must now be done via the declarativeNetRequest API, which has its own limitations, including a cap on the number of filtering rules and the size of regular expressions.
Attempting to maintain similar behavior to Manifest V2 presents several challenges, resulting in the following issues:
URL pattern = "http://*/*"
and when URL contains = "test"
results in two rules: http://*test*/*
and http://*/*test*
.URL pattern = "http://test/myurl*"
and when URL contains = "test"
results in one rule: http://test/myurl*
.URL pattern = "http://te*/myurl*"
and when URL contains = "test"
results in two rules: http://te*test*/myurl*
and http://te*/myurl*test*
. This accepts http://tetest/myurl
but excludes http://test/myurl
, which was valid with the Manifest V2 version.The extension requires the following permissions to function properly:
storage
: Stores the configuration and rules.activeTab
, tabs
: Displays the configuration screen in the browser tab.webRequest
, webRequestBlocking
, <all_urls>
: Modifies headers based on the rules table.storage
: Stores the configuration and rules.activeTab
, tabs
: Displays the configuration screen in the browser tab.declarativeNetRequest
, declarativeNetRequestWithHostAccess
: Modifies headers based on the rules table.The extension does not collect personal information.
The code is Open Source under Mozilla Public License 2.0