Skip to content

warren-bank/crx-simple-modify-headers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forked from

SimpleModifyHeaders

Summary of changes

  • "URL Pattern" field is removed
    • previously:
      • held a "match pattern"
      • was used to restrict access by the extension only to matching HTTP traffic
    • now:
      • the rules table is applied to all HTTP traffic
  • "Filter URL per rules" setting is removed
  • "When URL contains" field
    • previously:
      • was active only when the "Filter URL per rules" setting was enabled
      • held a string
      • was used to restrict the modification performed by the associated rule to only those URLs that contain the exact substring
    • now:
      • is always active
      • holds a case-insensitive regular expression pattern
      • is used to restrict the modification performed by the associated rule to only those URLs that match the regex pattern
      • can be left empty to inherit its value from the closest previous rule that does contain a regex pattern
  • "Header Field Name" field can optionally be chosen from a list of common values
  • "Header Field Name" field can fuzzy match substrings in "delete" rules by ending with the "*" character
  • "Delete All" button removes all rules
  • "Import" button reads rules from an external JSON text file
    • previously:
      • imported rules did replace the pre-existing set of rules
    • now:
      • imported rules will append to the pre-existing set of rules
  • "Parameters" button is renamed to "Settings"

Description

Extension for Firefox and Chrome.

The extension rewrites the headers based on a rules table.

The extension can be started and stopped via the button on the top right.

To save and apply the modification, you need to click on the save button.

It's possible to:

  • export the configuration into a file (json format)
  • import the configuration from a file. It supports the format of the Modifyheaders plugin

Rules table

The rules table contains lines with the following parameters:

  • action: add, modify or delete a header field
  • header field name
  • header field value
  • comment: a comment
  • apply on: "request" if the modification applies to the request headers or "response" if the modification applies to the response headers
  • status: on if the modification is active, off otherwise

Url pattern

We can choose the URLs on which the modifications are applied by modifying the URL pattern :

Parameters

The parameters button permits to:

  • Activate debug mode: shows detailed log messages in the extension debugging console of the browser.
  • Show comments: show comments field on the config panel
  • Filter URL by rules: activate the possibility to filter URL for each rule in the config panel. The header field will be modified only if the URL contains the configured value.

Firefox-specific issue

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"

Limitation

Due to limitations in the webRequest API of browsers, headers of requests, which are invoked by Javascript could not be modified.

Extension permissions

In order to work, the following browser permissions are needed for the extension:

  • storage: needed to store the configuration and the rules
  • activeTab, tabs: needed to show the configuration screen in the browser tab.
  • webRequest, webRequestBlocking ,<all_urls>: needed to modify the headers according to the rules table.

License

The code is Open Source under Mozilla Public License 2.0


Screenshots

screenshot

About

Extension for firefox and chrome to modify headers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 93.2%
  • Shell 2.8%
  • HTML 2.1%
  • Batchfile 1.2%
  • CSS 0.7%