让Fiddler调试localhost和127.0.0.1

今天看到Lulu的闪存问到Cookie的问题,然后引发更多问题,突然想到昨晚使用Fiddler调试是否使用gzip压缩时,发现IE7下的localhost无法被捕获了。呵呵,然后就直接搜索了“Fiddler localhost”,找到了原因。

以下引用至:http://www.fiddlertool.com/Fiddler/help/knownissues.asp

I don't see IE7 or .NET traffic sent to localhost or 127.0.0.1.

IE7 and the .NET Framework are hardcoded not to send requests for Localhost through proxies.  Fiddler runs as a proxy.  The workaround is to use your machine name as the hostname instead of Localhost or 127.0.0.1.

So, for instance, rather than hitting http://localhost:8081/mytestpage.aspx, instead visit http://machinename:8081/mytestpage.aspx.  Alternatively, you can use http://localhost.:8081/mytestpage.aspx (note the trailing dot after localhost).  Alternatively, you can customize your Rules file like so:

static function OnBeforeRequest(oSession:Fiddler.Session){
  if (oSession.host.ToUpper() == "MYAPP") { oSession.host = "127.0.0.1:8081"; }
}

...and then navigate to http://myapp, which will act as an alias for 127.0.0.1:8081.

我比较喜欢localhost.  方式。

如果你使用IIS7的话,还可以自己定制

<system.net>
  <defaultProxy>
    <proxy  proxyaddress="http://127.0.0.1:8888" />
  </defaultProxy>
</system.net>

这样,就会通过代理来访问了,从而Fiddler就能捕获到数据了。

 

最后还联想到以前DF介绍的一款Fiddler的插件,帮助我们查看被去空白的Javascript代码插件-- Fiddler2 - JavaScript Beautifier Plugin (Fiddler 2的JavaScript代码美化插件)

 

呵呵,有时候想起某些事情是需要有导火线的。

 

Technorati 标签: Fiddler,localhost,Javascript,Lulu
posted @ 2008-03-31 16:25  MK2  阅读(5755)  评论(3编辑  收藏  举报