GithubHelp home page GithubHelp logo

didierfred / simplemodifyheaders Goto Github PK

View Code? Open in Web Editor NEW
163.0 5.0 30.0 1.54 MB

Extension for firefox and chrome to modify headers

JavaScript 96.66% HTML 3.05% CSS 0.29%
firefox chrome extension headers

simplemodifyheaders's Introduction

SimpleModifyHeaders V 1.9.0

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:

  • Export your configuration to a file (in JSON format)
  • Import your configuration from a file, supporting the Modifyheaders plugin format. You can choose to append rules instead of replacing the existing configuration.

Rules table

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.

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 one of the configured values (using semicolon as separator)

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".

It's not possible to define a specific port number in url pattern, https://stackoverflow.com/questions/11425591/match-port-in-chrome-extension-pattern

Chrome / Edge specific issue

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:

  • Individual cookie modification is no longer possible so the option to manage cookies has been removed.
  • The 'add' and 'modify' options behave identically (modifying a non-existing header will result in it being added).
  • You may reach the browser's maximum filtering rules limit. If this occurs, a message will prompt you to deactivate some rules. However, this issue should be rare.
  • The previous method of first filtering via global "URL patterns" followed by an "URL contains" filtering is no longer possible. Instead, multiple patterns are used for filtering. For example:
    • 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.

Extension Permissions

The extension requires the following permissions to function properly:

Firefox

  • 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.

Chrome & Edge

  • 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.

Personal Information

The extension does not collect personal information.

License

The code is Open Source under Mozilla Public License 2.0

simplemodifyheaders's People

Contributors

baton34 avatar didierfred avatar gitoffthelawn avatar mre avatar recolic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

simplemodifyheaders's Issues

Only sending custom header some of the time

Hi. Thank you so much for creating and sharing this Firefox add-on.

I just started using SimpleModifyHeaders and I'm just sending one simple header. The header is often transmitted, but almost as often the header, as far as I can tell, is not transmitted. I am checking the header on the server both in my proxy server and using tcpdump, and sometimes it's just not there.

Can you give me a clue as to why this might be? The site is reloading, not coming from cache. I see it reload on the server.

I'm using Firefox 77.0.1. The plugin is 1.6.3.

There's only one header, on all requests. Here is the configuration export:

{"format_version":"1.2","target_page":"*://*/*","headers":[{"url_contains":"","action":"add","header_name":"ntn-id","header_value":"1001","comment":"NTN User ID","apply_on":"req","status":"on"}],"debug_mode":false,"show_comments":true,"use_url_contains":false}

You have any idea? Any help would be much appreciated.

Thank you again,
Yosi

Firefox-404

hi,
i cannot find simple-modify-headers on firefox anymore. i wanted to install on new firefox instance. why? your tool is user friendly. will it be back on firefox?

Feature request: Make it able to modify cookies

Now we can modify / overwrite all headers with this tool, but this tool doesn't work with cookie.

We can regard cookie as a large collection of headers. It would be good if we can SimpleModifyCookies just like SimpleModifyHeaders.

understanding URL patterns

i'm not understanding the URL pattern syntax

i want to inject css on AMO - if i disable the URL filter, this works fine, but none of the following work and it seems like they should all work...

*
*://*
https://*/*
https://addons.mozilla.org/*

Please switch from drop down menus to toggles

If you have mutliple headers set it is tiring to enable / disable multiple headers.
You could you switch the drop down menus for request / response and status on / off to toggles?

Thanks in advance!

"Cookie Add/Modify" should insert a space after semicolon

Browser

Firefox 110

Issue

When using the Cookie Add/Modify action, the cookie is added to an existing cookie by appending ;cookie_name=cookie_value without a space after the semicolon.

While I suspect that some web sites may tolerate this, the official spec calls for a space after the ; .

To Reproduce

Action Header Field Name Header Field Value Apply on
Delete Cookie anything Request
Add Cookie a=1 Request
Cookie Add/Modify b 2 Request

Result is Cookie: a=1;b=2.

Result should be Cookie: a=1; b=2.

References

value ENV var support?

Is it possible to add user ENV var support?

For example, if user ENV includes

	echo TOKEN
		123456test

then in SimpleModifyConfig

	Header Field Value: Bearer $TOKEN

?

Response headers can't be changed

I wanted to use this extension to modify "cache-control" response headers received from server-side.

However, I have found that response headers can't be added or modified at all.

Create two nonsense headers, one for request and one for response:

a

Testing this:

b

I normally use the fork Waterfox, but I tested in the above pictures with Firefox with a new profile.

Thank you for your help and time.

Causes playback problem on youtube.com

I deducted the problem I'd been having to this extension. When enabled, videos on youtube give me the following error message: "An error occurred. Please try again later. (Playback ID: Xo5eszLlAn-G72fc)" Upon refreshing the page, I'm able to view the videos. But the first time I click on a youtube video, or when it auto plays the next video, it get this message.

[feature request] Rules list in folders (accordeon compact/extend list) and auto "Save" after "Status" toggle.

It is very useful application. But with large lists there is vertical scroll bars occured and after toggle some "Status ON/OFF" button i need to scroll down to the "Save" button.
May be you can add some named groups for list items with something like "accordeon" compact/extend lists? And "auto-save" checkbox option for auto apply changed "Status ON/OFF" button clicks.
It can reduce vertical size of list and increase usability for developers/users.
Thanks!

cannot disable csp on Twitter

on Twitter.com is no longer possible to disable csp using the addon (i use the general rule MODIFY :content-security-policy with EMPTY header value wich works flawlessy for most websites .)

Cookie Delete sets value to undefined when cookie name does not already exist

Browser

Firefox 110

Bug

When the cookie name in a "Cookie Delete" rule does not already exist in the request, the extension will append the cookie with a value of undefined.

Precondition

For this bug to occur, you must navigate to a web site that already has a cookie associated with it.

To Reproduce

To reproduce on any web site, use the following rules. The first two will remove the entire Cookie header, then add a simple Cookie header. The third rule will attempt to delete the abc cookie which does not exist.

Action Header Field Name Header Field Value Apply on
Delete Cookie anything Request
Add Cookie some_cookie=some_value Request
Cookie Delete abc does_not_exist Request

Result as it appears in Firefox browser

image

Support multiple URLs in the "When URL contains" field

As far as I can tell, only a single URL substring is supported per rule, unlike the shared URL patterns field which takes a semicolon-separated list. It would be useful to do this per-rule too so that I don't have to duplicate a number of rules across multiple domains.

need help in direct installation

Hi How can I directly install this extension to chrome by the release Zip. This is not an issue but I havent fund anywhere to contact to you

导出配置文件中无header规则

导出配置文件如下:
{"format_version":"1.2","target_page":"*","headers":[],"debug_mode":true,"show_comments":true,"use_url_contains":true}

Fix AMO links

The links on the AMO page should always point to https://github.com/didierfred/SimpleModifyHeaders.

The Homepage link is currently broken, and the other links point to an older branch of the repository.

Black icon on a dark theme

I want to draw your attention to the fact that the extension icon in the off state is practically not visible on the dark panel (if a dark theme is installed in the browser). It is desirable to make it, for example, red.

Slightly change the action of clicking on the icon button

Is it possible to slightly change the action of clicking on the icon button on the extensions panel?

The Configure (Settings) item is not as often and actively used as the Stop/Start function of the extension. Therefore, when clicking on the extension icon with the LMB, I would like to receive not a selection menu, but immediately Stop/Start.

And the Settings (Configure) item could be added to the standard menu of the extension icon, which opens by RMB, as is done in many extensions and is in fact already standard.

Not able to save changes with Firefox 71

Today i upgraded my fedora 31 with dnf. I've got a new version for firefox (71). Now i can not save changes to the fields in SimpleModifyHeaders.

The problem is on 2 different Linux-Systems. Both with Fedora 31 and Firefox 71.

Maybe the reason is the same as here descibed: https://github.com/passff/passff/issues/427
PassFF is not working, when FF is compiled with gcc, but it works, if it is compiled with clang.

Feature: Add site to block referer

This header works better than the older referrer control but it's missing an easy to add option to add site to be blocked. In Referrer Control it was a context menu to add it so did not even need the extension to even show on the toolbar. This one requires always showing on toolbar as I could not other way to start it and manually typing in to add a site to it.

  1. Easy option to add site to block referer
  2. Give management capability to the Add-Ons page so do not have to show in a crowded toolbar window
  3. Import configuration - give option to not delete current configuration so a single site import can be done

When URL contains - same matching functionality as Url patterns?

I cannot get SimpleModifyHeaders to recognize a 'When URL contains' pattern. What is the logic here, the same pattern matching as used by the 'Url pattern' matcher (i.e. including path wildcards) simple URL string contains sub-string, or something else?

Thanks in advance, great extension BTW.

Per-rule URL Patterns

This is nice... but it would be nicer, if one could add URL patterns to each rule (in addition to global URL patterns).

`;` seperated URL contains doesn't work as expected

Example url_contains String: i.gyazo.com;i.redd.it;preview.redd.it;i.imgur.com;.photobucket.com.
Only the first domain works, even though multiple domains are listed, unsure if related, but Filter URL per rules is checked.

Auto-scrolling to the top is rather annoying

We use your great add-on in a large software project where we need to fake headers quite often to impersonate different users with different roles for testing and development.
That means we have a rather huge list of available headers and every time one clicks one of the buttons, the list scrolls to the very top. So if we have to deactivate one header, activate another and save the changes afterwards, we have to scroll at least three times. That's rather annoying. I'd favor if the list just didn't scroll at all.

Otherwise: Great job and thanks for your work!

Firefox does not add/modify response headers

I configured X-Test-Request and X-Test-Response for request and response headers respectively.

image

Result: X-Test-Request is set, but X-Test-Response is not.

image

Version: Firefox Developer Edition 77.0b4 (64-bit) MacOS High Sierra 10.13.6

image

SMH does not override Accept-Language header

When setting the Accept-Language header in SMH to XXX, firefox keeps the standard setting and only adds the XXX value to that header.

grafik

Could you replace these values completely please?

Not rewrites headers in request made by another addon

I use Imagus addon for view images in full size on certain sites. Its take original picture link and defines new link for fullsize image. In this case it fetch api.500px.com for image data and SMH did not touch header of this request. Why header stays not modified?
Here screenshot with "debug mode" and "Filter URL per rules" enabled.

smh

export / import rules individually

It is advisable to add the export / import function not only for all rules at once, but also individually, one at a time. So that when importing a new rule, the old ones are not deleted.

Add POST data

It would be very cool if we could also add POST data via this extension... I tried POST key=value&key2=value2 and that didn't work.

This was on Firefox btw.

[fork] just wanted to let you know that I forked this project and made a bunch of (incompatible) changes

the repo is here

summary of changes:

  • URL patterns are changed from "match patterns" to regular expressions
  • "Filter URL per rules" setting is always enabled
  • "When URL contains" field 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
  • config page CSS rewritten to utilize full page width

screenshots

Missing "When URL contains" field

"When URL contains" field missing immediately after the first installation (or after reinstalling). It can appear only after importing the rules. v1.8.1.

1.6.3 not working anymore

As mentioned here : #8
i have issues with latest version 1.6.3 aswell.
Tested in Firefox 61.0.1 and 63.0.3, both are not working.
The icon remains gray.

Switching back to V 1.6.1 : all is OK again...

Localhost on Firefox doesn't seem to work

Hey,

Running a simple python server on localhost:8000 and connecting to it using Firefox

Setting the URL pattern to http://localhost/* or http://127.0.0.1/* (and connecting to the corresponding url) doesn't set the headers I want

However, using no URL pattern and it modifies the headers correctly. Not sure if it's just a firefox thing though.


Also, can you support file://? If, in theory, the only thing holding that back is your regex then I can confirm that this also doesn't seem to work, as I disabled that for testing.

Cannot import settings

I'd like to import settings from a .conf file, but when I click the "Import" or "Append" buttons, and click "OK" on the dialog box, the file manager window does not show up (it does when clicking the "Export" button, though).

Any help would be very welcome.

Not started/no headers send after upgrade to 1.6.3 in Firefox

Version 1.6.3 does not work anymore in Firefox:

  • no header gets send with previously working configuration

Removed and re-installed extension:

  • no header gets send with example configuration (httpbin.org replaced with other known hostname)

Thank you for your efforts and a useful extension!

Semicolon to separate URL patterns doesn't work

Using FF 68.0.1.
URL pattern of: *://*.x.com/* -- working great.
URL pattern of: *://*.x.com/*; *://*.y.com/* -- never gets applied either to x.com nor y.com.

I see the next version allows assigning rules to specific URLs, so maybe that's already covered.

EDIT: It was the space after the semicolon. Doh. In my defense it's fairly common to want it there :)
Using target.split(/\s*;\s*/) would be appreciated.

FF 83.0 didn't work.

Didn't seem to work at all, on FireFox 83.0 (64bit)

I added a simple rule, and applied it to all requests "*". I did not see the header modified in the dev console.

Headers are not injected into JS requests

Hello, I am not sure if this should be an issue or not, but sometimes, website needs to use websocket connections, or any other AJAX / fetch requests, which are invoked by Javascript. These JS invoked requests do not have injected headers by SimpleModifyHeaders plugin. Is this intended?

It would be awesome if there is some kind of option to force javascript requests to use headers too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.