├── .gitignore ├── README.mkd ├── doc └── main.md ├── icon.png ├── lib └── main.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.xpi 2 | -------------------------------------------------------------------------------- /README.mkd: -------------------------------------------------------------------------------- 1 | X-Forwarded-For-Header 2 | ====================== 3 | 4 | ### About ### 5 | This addon inserts [X-Forwarded-For](http://en.wikipedia.org/wiki/X-Forwarded-For) into the HTTP Request header. 6 | The value is currently the IP 8.8.8.8 witch is an IP in United states. This will make some websites think that you are a proxy that is forwarding a client from United States. 7 | 8 | ### Building ### 9 | To build the addon you have to use the addon builder sdk from mozilla. 10 | Download it here: 11 | 12 | After you [setup the 13 | addon-sdk](https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html) start firefox with the addon installed automaticly with the following command: 14 | 15 | ```Shell 16 | cfx run 17 | ``` 18 | 19 | If you want to build an xpi package run: 20 | ```Shell 21 | cfx xpi 22 | ``` 23 | -------------------------------------------------------------------------------- /doc/main.md: -------------------------------------------------------------------------------- 1 | This addons inserts the X-Forwarded-For field into the HTTP Request header. The fields value is set to 8.8.8.8 2 | This makes some websites to believe you are located in the United States. 3 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marson/XForwardedForHeader/3a3574b43ddf0c628759c8db7feeb50d45b406b3/icon.png -------------------------------------------------------------------------------- /lib/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // modules 4 | const {Cc,Ci} = require("chrome"); 5 | const prefs = require("sdk/simple-prefs"); 6 | 7 | // fields 8 | var httpRequestObserver; 9 | 10 | exports.main = function(options,callbacks) { 11 | 12 | // Get IP address from Addon Preferences 13 | var ip = prefs.prefs["ip"]; 14 | 15 | // Update ip address when prefrences are updated 16 | prefs.on("ip", function (prefName) { 17 | ip = prefs.prefs["ip"]; 18 | }); 19 | 20 | // Create observer 21 | httpRequestObserver = 22 | { 23 | observe: function(subject, topic, data) 24 | { 25 | if (topic == "http-on-modify-request") { 26 | var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); 27 | httpChannel.setRequestHeader("X-Forwarded-For", ip, false); 28 | } 29 | }, 30 | 31 | register: function() 32 | { 33 | var observerService = Cc["@mozilla.org/observer-service;1"] 34 | .getService(Ci.nsIObserverService); 35 | observerService.addObserver(this, "http-on-modify-request", false); 36 | }, 37 | 38 | unregister: function() 39 | { 40 | var observerService = Cc["@mozilla.org/observer-service;1"] 41 | .getService(Ci.nsIObserverService); 42 | observerService.removeObserver(this, "http-on-modify-request"); 43 | } 44 | }; 45 | 46 | // Register observer 47 | httpRequestObserver.register(); 48 | }; 49 | 50 | exports.onUnload = function(reason) { 51 | 52 | httpRequestObserver.unregister(); 53 | }; 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xforwardedforheader", 3 | "license": "MPL 2.0", 4 | "author": "Jakob Landbo", 5 | "version": "1.0.1", 6 | 7 | "fullName": "X-Forwarded-For Header", 8 | "id": "jid1-vasLCl9ZsexfAQ", 9 | "description": "Inserts X-Forwarded-For field into the HTTP header", 10 | "homepage": "https://github.com/marson/XForwardedForHeader", 11 | "preferences": [{ 12 | "name": "ip", 13 | "title": "IP Address", 14 | "description": "The IP address for the X-Forwarded-For header field.", 15 | "type": "string", 16 | "value": "8.8.8.8" 17 | }] 18 | } 19 | --------------------------------------------------------------------------------