Developer

Using Fiddler to debug HTTP

Justin James offers tips and strategies on how to use Fiddler for debugging HTTP sessions. He says this should cover your needs for most scenarios.

I use Fiddler on a regular basis for debugging HTTP sessions, and in this post, I will give a brief walk-through of how you can use Fiddler as well.

First, you will need to download Fiddler (you may want to check out some of the various Fiddler add-ons). Once you go through the easy installation, you will be able to start Fiddler (Figure A). Figure A

Fiddler after starting up (Click the image to enlarge.)

In the lower left corner of Figure A, you will see "Capturing," which means that it is recording HTTP traffic. To toggle recording on and off, you can click the Capturing label, press [F12], or use the option on the File menu. If the screen ever gets too cluttered to work with, you can go to the Edit menu and choose Remove and select what data you wish to delete from the display.

Each line on the left represents an HTTP connection that was made. By selecting a line, you can inspect its contents. Make sure that AutoDecode at the top of the screen is selected so that any compressed HTTP traffic is showed decompressed. Look to the right half of the screen for the details. You will see on the top a variety of tabs. The most-used section is Inspectors, which allows you to see what the details of the HTTP request and response were. When in the Inspectors tab, there are additional tabs for the bottom half that allow you to look at different aspects of the request and response. TextView, Raw, and XML are the three tabs that I find most helpful. TextView shows the body of the response as plain text, Raw shows the entire response, and XML displays XML in a collapsible XML browser view.

Something that you will want to take care of pretty quickly is to set Fiddler up to work with HTTPS traffic; after all, a lot of the services and applications that you will want to debug use encryption. Another nice feature is the ability to allow remote connections (this is found under Fiddler's options). With this option set, you can have other computers route their HTTP traffic through your running copy of Fiddler by setting the proxy settings in the network or browser, and then you can debug their traffic as well. On the topic of debugging, you will want to check out the Request Builder tab at the top right; it allows you to custom create an HTTP request, and it is a perfect way to test Web services (especially REST-ful ones). You can go to the Filters tab in order to do things like establish conditional breakpoints and not display traffic that meets certain requirements, which is great when working on a system with a ton of traffic.

Fiddler has a number of additional pieces of functionality, but this should cover your needs for about 90% of scenarios. Please share any additional tips or Fiddler strategies in the discussion. I'd love to hear them!

J.Ja

About

Justin James is the Lead Architect for Conigent.

Editor's Picks