Sponsors

Using Fiddler2 Web Debugging Proxy with Firefox

Posted on 7/26/2007

Here's a cool tip. You can use Microsoft’s amazing Fiddler2 Web Debugging Proxy with Firefox and other browsers, not just Internet Explorer. Fiddler2 doesn’t work with Firefox automatically as it does with IE, but it can be made automatic without a lot of work. Jump to the bottom of this article if you just want the facts. If you want to know how it works, read on.

Here’s why Fiddler2 can work with Firefox. When Fiddler2 starts up, it writes a script called BrowserPAC.js to your hard drive in folder under My Documents that can be reached with a URL something like this one:

file:///C:\Document%20and%20Settings\kevin\My%20Documents\Fiddler2\Scripts\BrowserPAC.js

Your path will be different because you have no "kevin" folder on your machine (unless your name is Kevin, in which case, "Cool name, dude! You rock!"). When Fiddler2 is not running, the script inside this file will look like this:

function FindProxyForURL(url, host)
{
    return 'DIRECT';
}

‘DIRECT’ means "don’t use a proxy, go straight to the web site". When Fiddler2 is running, the file will contain something like this:

function FindProxyForURL(url, host)
{
    return 'PROXY 127.0.0.1:8888';
}

In this latter case, the command to the browser says to use a proxy for all web conversations. Fiddler2 is that proxy when it’s running. As such, it can capture everything moving back and forth, even decrypting SSL traffic that flows through it. Now, to set up this little script to be called by Firefox, follow these steps:

  1. Run Fiddler2 and minimize it.
  2. Run Firefox.
  3. Open Tools/Options from the Firefox main menu.
  4. On the Network tab, find the section marked Connection and click the Settings button.
  5. Check the last radio button entitled "Automatic proxy configuration URL:" and fill in the field with the URL to that BrowserPAC script referenced above. That URL will be specific to your machine because your "My Documents" folder is in a different place.
  6. Click the Reload button to the right, then click OK twice to close and save your changes.
  7. Load a web site into the browser. Everything should look pretty normal.
  8. However, now bring Fiddler2 up. You should see all of the HTTP sessions that were opened during your web request. You can use the session inspector and get various views of the data that flowed back and forth between Firefox and the web server(s).

Now, every time you load Firefox on your machine, it will automatically use Fiddler2 if it’s running because of that little script switcheroo trick that Fiddler2 does. The only thing that you need to be wary of is that if you unload Fiddler2 while Firefox is running, subsequent web requests may show a message saying something akin to "Failed - The proxy is refusing requests." Internet Explorer and Fiddler2 work together very closely to avoid this kind of problem. Unfortunately for Firefox, the relationship with Fiddler2 is a bit more strained. To fix this problem, you can open the Tools/Options/Network/Connection/Settings dialog again and press the Reload button. Or you can simply close the browser and restart it.

Comments

POST A COMMENT
Your name:
Your e-mail address (will not be shared with others):
Your comment: