Modifying All Request Headers in Fiddler

This quick guide will show you how you can add and modify headers in Fiddler and them to all requests.

There will be times where you will need to test performance or functionality of web apps which may require the modification of request headers – for example, if you were to move to a shared hosting environment and want to test the functionality and performance of the new host without changing DNS records, you will need to modify the HOST header otherwise the host will not know which site you want to visit.

  1. Firstly, launch Fiddler!
  2. Click the Rules menu item and Customize Rules (or CTRL + R)
  3. Do a find for onBeforeRequest
  4. This is where you will put the code to add/modify a header

To add or modify a header:

oSession.oRequest["HeaderName"] = "New header value";

So if you want to modify the HOST header so that it looks like you are requesting, your custom rules file will look like this:

oSession.oRequest["Host"] = "";

Source: You can do a lot more with the custom rules file – see here for more information:

2 replies on “Modifying All Request Headers in Fiddler”

Using the script engine is very flexible and gives you a lot of power. But to do something as simple as blindly adding a single request header to all requests, you can use the Filters tab.

Nice! I hadn’t noticed this tab before – you learn something new everyday 🙂

Comments are closed.