11

Is there a way (Firefox add-on or about:config setting) to send a custom HTTP header for requests to a certain host?

Example: Send the header Foobar: true if (and only if) I request a resource from the host foo.example.com.

Bonus points if the protocol can be specified, too (e.g. only send the header when requesting over HTTPS).

(see my question Use additional “password” in Referer to hide private site? on IT Security SE on why I’d like to do it)

What I found so far

6

If you are not restricted with Firefox, you can use Google Chrome's extension Header Hacker.

It provides:

  1. custom request headers (you're able either add new headers or override existing ones)
  2. permanent headers for specified hosts (you're able either add new headers or override existing ones)

So that you can solve your problem with second feature.

I'm using the extension a lot and it works fine for me.

  • Thanks. I’m restricted to Firefox, but your answer might of course be helpful for others. :) – unor Aug 22 '13 at 16:13
  • 1
    The link is broken – Taha Jahangir Sep 9 '14 at 8:10
  • 1
    @TahaJahangir the extension's maintainer have changed the name of the app recently. I have updated the broken link. And yes, the extensions is really helpful -- I'm using it on daily basis – ajukraine Sep 16 '14 at 13:23
  • what if the extension has a bug, or the extension does not work with the browser version you'd like or if the developers simply stopped updating the extensions ? I see this happening for most, if not all Firefox extensions which let you add/modify request headers. – MasterJoe2 Dec 28 '17 at 0:50
5

The Firefox add-on, Header Tool, does what you are looking for: https://addons.mozilla.org/en-us/firefox/addon/header-tool/

I just tried it out to restrict my custom request header to localhost.

  • 1
    what if the extension has a bug, or the extension does not work with the browser version you'd like or if the developers simply stopped updating the extensions ? I see this happening for most, if not all Firefox extensions which let you add/modify request headers. – MasterJoe2 Dec 28 '17 at 0:50
  • 1
    This extension is defunct with Firefox 57. – Jason R. Coombs Jul 11 '18 at 20:34
2

Since the release of Firefox 57, I've found the plugin Modify Header Value does the trick.

Modify Header Value can add, modify or remove an HTTP-request-header for all requests on a desired website or url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.