Friday, March 1, 2013

HTTP Request Headers Testing

This is a trick I’ve been using for a while, but I wanted to share.

Sometimes third party software requests your Web Pages/Services and pass data via the HTTP Request Headers.

If you want to simulate these requests you can do so with Fiddler. Fiddler acts as a “man in the middle” for all the requests coming from your browser. Therefore, it has the ability to alter your HTTP requests before they are passed along to the appropriate destination.

Here is how you add a header to your browser requests.

Launch Fiddler and select Rules > Custom Rules…

Find the function called

static function OnBeforeRequest(oSession: Session)

Within this function you can add items to your request header by assigning key/value combination to the “oSession.oRequest” array.

Here’s an example:

static function OnBeforeRequest(oSession: Session)
    oSession.oRequest["Custom_Header_Key"] = "Custom Header Value";

Now any request from a browser will contain that value. Including localhost requests


For more information about Custom Rules, I encourage your to visit the Fiddler Script Cookbook


  1. Nice one Justin. I typically only have to do these sorts of things one-off so I'll make a request, choose to replay it and manually add/change the header. But I'll have to remember this for the future. Thanks!

  2. I've recently used ModHeader ( in Chrome to do the same thing. Nice thing is that you can have four sets of header variables and easily switch between them.