Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Fiddler on localhost only

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

Thanks,

like image 387
Kris-I Avatar asked Feb 20 '12 07:02

Kris-I


People also ask

How do I configure my Fiddler to listen to localhost?

If you're using FireFox, Fiddler's add-on will automatically configure it to not ignore localhost when capturing traffic. If traffic from localhost is still (or suddenly) not appearing, try disabling and re-enabling traffic capture from Fiddler to goad the add-on into fixing the proxy configuration.

How does Fiddler capture localhost traffic?

To get Fiddler to capture traffic when you are debugging on local host, after you hit F5 to begin degugging change the address so that localhost has a "." after it.

Does Fiddler act as a proxy?

Fiddler Classic and fiddler Everywhere are special-purpose proxy server tools for debugging web traffic from applications like browsers. They're used to capture and record this web traffic and then forward it onto a web server.

Why is Fiddler not capturing traffic?

NET Framework are hardcoded not to send requests for Localhost through any proxies, and as a proxy, Fiddler Classic will not receive such traffic. This behavior was changed for Internet Explorer 9 in the Release Candidate build. IE9 RC allows Fiddler Classic to proxy traffic sent to localhost or 127.0.


3 Answers

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

like image 175
nadavy Avatar answered Oct 30 '22 02:10

nadavy


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

like image 20
Dr Blowhard Avatar answered Oct 30 '22 02:10

Dr Blowhard


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.

like image 26
Adrian Iftode Avatar answered Oct 30 '22 03:10

Adrian Iftode