Search This Blog

Monday, January 17, 2011

Adding custom http header to each request with FireFox and IE

Sometimes you need to add an extra http header for each request , to simulate requests from third parties or clients.
in my case i needed to add an extra header for each request to simulate "single sign on" to my system, so an extra header added by the client with the user id , and i wanted to test such solution, without the need to develop a proxy or any test tool, so i found this.
For Firefox -  use the add on Modify header to Add, modify and filter http request headers.
For IE browser - it more complicated:

  • you have to download Fiddler
  • Open the 'Customize Rules' window (Rules->Customize Rules...)
  • Find this function: static function OnBeforeRequest(oSession: Session)
  • inside this function, add the header values that you would like to add, in this format: oSession.oRequest["headerName"] = "headerValue";
To get your new header on each request , open your IE , and make sure Fiddler is running.

enjoy 
Yaniv Tzanany

No comments: