From the mail bag…
Q:When I use IE10 on Windows 8 to visit an IIS Express instance using the following URL http://ipv4.fiddler:2468/, I get an unexpected error message.
HTTP/1.1 400 Bad Request
Date: Wed, 22 Aug 2012 19:59:52 GMT
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN””http://www.w3.org/TR/html4/strict.dtd”>
<META HTTP-EQUIV=”Content-Type” Content=”text/html; charset=us-ascii”></HEAD>
<BODY><h2>Bad Request – Invalid Hostname</h2>
<hr><p>HTTP Error 400. The request hostname is invalid.</p></BODY></HTML>
What’s up with that?
A: First, it’s important to understand that you don’t need to use any special “.fiddler” addresses for Fiddler to capture local traffic when using IE (since version 9). You only need to use those when your client is making its HTTP requests using System.Net (e.g. HTTPWebRequest), which unconditionally bypasses the proxy for addresses it deems “local.”
Having said that, you’ll find that the same request works if you use the address http://localhost.fiddler:2468/. The reason that localhost.fiddler works is that when Fiddler gets this URL, it sets the request’s Host header to “localhost” before passing it to the IIS Express server. If you instead use ipv6.fiddler as the request URL’s hostname, Fiddler sets the Host header to “[::1]”. If you use ipv4.fiddler, Fiddler sets the Host header to “127.0.0.1”.
IIS Express only expects the “localhost” Host header value and returns the HTTP/400 for the “127.0.0.1” Host, saying, in effect “I don’t have a website with that hostname.”