User guide

How to use ModHeader

  1. Click on the at the top and select Request Header.
  2. Add the request header to add/modify on the Name and Value columns
  3. To remove a request header from being sent, set the Name column only

  1. Click on the at the top and select Response Header.
  2. Add the response header on the Name and Value columns
  3. To remove a response header from being returned, set the Name column only

  1. Find the header that you would like to disable
  2. Uncheck the checkbox on the left side of the header to disable the header modification, or check it to enable the header modification.

  1. Find the header that you would like to remove
  2. Click on the on the right side of the header to remove (remember that you can disable a header without removing it!)

  1. Click on the at the top and select Filter.
  2. URL Pattern: Filter by URLs using JavaScript regex expression (for example, .*.google.com.*). Header modifications will be enabled on ANY of the URLs that match the given regex.
  3. Exclude URL Pattern: Enable header modifications only on URLs that do NOT match the given regex.
  4. Resource Type: Enable header modification on certain types of requests.

  1. Dynamic value is a way for you to set a different header value automatically by evaluating a small piece of JavaScript. This is an advanced feature that few people will need, but is very powerful.
  2. To setup dynamic value, simply define the value as a function like this: function({ url, oldValue }) { return 'World'; }
  3. Instead of applying the textual value as-is, if the value starts with 'function', ModHeader will evaluate the function and use its return value instead. Note that you will receive a structure with the url field containing the URL for the request.
  4. You can click on the to get a bigger textbox for easier entry.
  5. Please make sure that the function works correctly. Do NOT enter arbitrary function that you copy somewhere without understanding how it works.

  1. Click on the at the top and select URL replacement.
  2. Enter the original URL string that you want to replace in the left text box.
  3. Enter the replacement URL that you want to use in the right text box.
  4. ModHeader will redirect the original URL to the replaced URL.
  5. Note: You can use dynamic value for the replacement URL too.

  1. You can have many profiles to store your ModHeader settings
  2. Add profile: Click on Add Profile on the left navigation drawer to add a new profile.
  3. Switch profile: Click on any existing profile on the left navigation drawer to switch to it.
  4. Only the currently selected profile is active at a given time

  1. Click on the name of the profile at the top, and enter a new name.

  1. Click on the circular badge of the profile at the top.
  2. In the dialog, you can enter 1 character for the profile's badge, or change its color.

  1. The green checkbox indicates that a profile is active.
  2. The red dot indicates that a profile is not active.
  3. Only the active profile's modifications will be applied.

  1. By default, only the selected profile is active.
  2. To enable other profiles, right click on the profile, and select "Always stay on"
  3. An active profile will show a green checkbox at the bottom right hand corner.

  1. All of your edits are automatically saved to your accounts in the browser.
  2. To restore to a previous snapshot, click on the menu at the top-right corner, then select Restore from cloud backup.
  3. You will see a list of backup profiles on your account. Click on the one you want to restore
  4. You can also use this dialog to clear all cloud backup data.

  1. Click on the button at the top right corner.
  2. Select the profile(s) you want to share
  3. Copy the generated URL. Your profile is encoded in the URL.

  1. Click on the icon at the top right corner.
  2. Select Import profile(s):
  3. Paste the exported URL into the import dialog:

  1. Click on the menu at the top right corner, then select Lock to Tab:
  2. When Lock to tab is on, all header modification will be restricted to the current tab. ModHeader will not change headers for any other tab, even if the locked tab is closed.
  3. To turn off, simply click on the Unlock tab button.

  1. Override existing value: The last value entered in ModHeader will replace all existing values.
  2. Value concatenation: Header values are concatenated together. e.g., if there is already an existing header Test=1 and there is a new header Test=2, then the final header will be Test=12
  3. Comma separated concatenation: Header values are concatenated together with a comma in between. e.g., if there is already an existing header Test=1 and there is a new header Test=2, then the final header will be Test=1,2

  1. If you are using Chromium-based browsers, you may notice that your newlwy added header got its name transformed to lowercase. This is done by the browser, and unfortunately ModHeader can't do anything about it.
  2. According to HTTP specification though, header names are case-insensitive, so the server should handle the request correctly regardless of the case.

According to Chrome's webRequest API doc, The following headers are currently not provided to the onBeforeSendHeaders event. This list is not guaranteed to be complete nor stable.

  • Authorization
  • Cache-Control
  • Connection
  • Content-Length
  • Host
  • If-Modified-Since
  • If-None-Match
  • If-Range
  • Partial-Data
  • Pragma
  • Proxy-Authorization
  • Proxy-Connection
  • Transfer-Encoding

As a result, modifications on some of these headers may behave slightly differently than expected.

Additionally, you may want to check if the request is cached. A request does not go through the network and cannot be modified. In Chrome, you will typically see a message like this for cached request: "Provisional headers are shown. Disable cache to see full headers."

  1. Visit us at modheader_selenium on GitHub for more information on how to use ModHeader in WebDriver.
  2. If you are using Node, you can also use chrome-modheader or firefox-modheader.