Archive for the 'Web Development' Category

Capturing, Debugging localhost HTTP traffic with Fiddler

Fiddler does not capture packets sent to the localhost URL which makes debugging web applications hosted in your local machine painful.

Here is how I configured Fiddler to debug web applications hosted in your local machine,

Lets say your application is accessed using the URL http://localhost:8090/MySpiffyApp/default.aspx. To make fiddler capture the HTTP requests sent to this URL, all you have to do is edit the HKCU\Software\Microsoft\Fiddler\ReverseProxyForPort and set the decimal value to 8090. This tells fiddler to proxy all traffic sent to HTTP port 8888 (default proxy port) to HTTP port 8090. Now access the application using the fiddler proxy port

http://localhost:8888/MySpiffyApp/default.aspx

and you should be able to see the packet trace in Fiddler.

If you see the page below instead of your application then try restarting Fiddler and make sure the registry key name matches exactly as above.

GET / HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: ASPSESSIONIDAADBDSRQ=NJJLKNGCKNJMNIIFAIDFCEIB
Cache-Control: max-age=0

If you’d like to configure Fiddler as a reverse proxy instead:

  1. Set the HKCU\Software\Microsoft\Fiddler\ReverseProxyForPort registry DWORD to the local port you’d like to route inbound traffic to
  2. Restart Fiddler

Let me know if this didn’t work for you or if you have another way of debugging web applications hosted on your local machine.