Use Fiddler on localhost only

Is there a way to set Fiddler software to log only "localhost" and not all the web traffic ?

Thanks,


Solution 1:

Yes you can. Fiddler has a filters option in which you can specify the name of your computer. Here's the steps:

  1. Make sure you have the latest version of fiddler
  2. Click on the "Filters" tab (in the same line of Inspectors).
  3. Click on "Use Filters"
  4. In the text area enter the name of your computer.
  5. Left click on the request area (so it will be saved).

If everything went well, fiddler has a green arrow on the Filters tab. Just browse to the website using your machine name so instead of:

http://localhost/MySite

Go to

http://my-machine-name/MySite

Solution 2:

I found these ways to only log localhost traffic, either should work.

  1. 'Show only Intranet Hosts', which excludes hostnames with a dot in them

Filters > Show only Intranet Hosts

  1. 'Show only the following Hosts' just specify only to log localhost as below

specify only to log localhost

Solution 3:

Here you can find how.

When I test local websites I usually add an entry in the hosts file %systemroot%\System32\drivers\etc\hosts

127.0.0.1   somewebsite

And then I set the bindings on IIS 7 to point to somewebsite
So I can test using "http://somewebsite". Fiddler tracks this.

update

To show only the localhost traffic:
Go to Rules\Customize Rules...
On Handlers class add this menu option

...
    class Handlers
    {

        public static RulesOption("Show Localhost Only")
        var m_ShowLocalHostOnly: boolean = false;
....    

On the function OnBeforeRequest

... static function OnBeforeRequest(oSession: Session) {

    // Hide requests based on target hostname.
if (m_ShowLocalHostOnly && 
            !(oSession.host =="127.0.0.1" 
              || oSession.host =="localhost" 
              || oSession.host =="somewebsite"))
            {
        oSession["ui-hide"]="true";
    }

...

Save this file (Ctrl + S), then choose the new option from the Rules menu.