It happens eventually to all web developers. It’s happened to me twice in the last week. You make one simple change to your web site and then you can no longer access it. When you browse to it in IE you get some completely useless “We can’t access the page you are looking for” error. In FireFox, it at least tells you that you have a “Redirect Loop” and in IE6, if you are fortunate enough to still be writing for that browser, you can see that it is blinking at you as it tries to retrieve the page(s) multiple times. But how do you know what’s redirecting to what? For that matter, other than running a browser that told you, how would you even know it was a 302 error?
I know I’ve mentioned this before but it’s definitely worth repeating. Get yourself a copy of Fiddler.
Fiddler is a proxy that runs on local host. By default when you run it, it automatically installs itself as a proxy in IE so you really don’t have to know much more than how to install software to get up and running with it. When you access a web site with it, it will tell you everything that is going on. What headers are being sent. What headers are coming back from the server. Files that are being requested. Status codes that are coming back. Any time I have a client-side problem with my web sites, or any time I have a problem with my web sites that I can’t explain from the server side, I reach for Fiddler. More often than not, it tells me or at least guides me to what the real problem is.
For example, last week I was given the task of creating a 301 redirect from one domain to another. I thought I had the code written correctly to do this, but when we went to access the domain it went into an infinite loop. Obviously something was wrong, but what?
When I ran similar code on other domains it worked correctly. When I ran Fiddler, I found that the page was redirecting to itself multiple times. Odd. What would make it do that?
So back to my code, where I quickly discovered that I had left out a character in my replace function so that domain A was never being rewritten to domain B so domain A was constantly redirecting to itself.
This morning’s error was a little more fun. My designer was trying to install a module into DotNetNuke last night when the site suddenly “stopped working.” Same deal. Only this time it is because there is some module that is redirecting from the home page to another page and then that other page is redirecting back to the home page. Again, I would have never been able to track this down if I hadn’t had Fiddler to help me.
I’ve also used this to verify that javascript tracking codes are working correctly. If you need to see traffic that is going between the browser and the server, Fiddler is the tool you are looking for.