Saturday, August 24, 2002
Just gotta love MSIE …
I have a question about HTTP for you. Okay. If you compile Seminole 2.14 and go to a URL that is a directory with an
index.html
in it, you will find that (unlike Apache), I instead just send out a temporary redirect to the/index.html
URL instead of serving up the index.html as the directory URL.Now, it seems that this works fine with all browsers except one: Microsoft Internet Explorer. Apparently a
302 Redirect
causes MSIE to just display the redirect page.
Question from Mark via email
The solution Mark found was to not send out the HTTP header
Content-Type:
and then MSIE would work properly. When I
investigated though:
Very curious. Using MSIE 5.0 (original and SP2) if I went to:
http://www.example.net/testredirect
I got redirected. But if I go to
www.example.net/testredirect
I get the MSIE redirect page (and not the one from the web server!).
My reply to Mark's email
Mark then asked if it was a violation of RFC-2616
to not send out the Content-Type:
header. Nope.
7.2.1 Type When an entity-body is included with a message, the data type of that body is determined via the header fields Content-Type and Content- Encoding. These define a two-layer, ordered encoding model: entity-body := Content-Encoding( Content-Type( data ) ) Content-Type specifies the media type of the underlying data. Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. There is no default encoding. Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".
§ 7.2.1 of RFC-2616
The SHOULD
gets Mark off the hook for not sending out the
Content-Type:
header.
But then Mark also found:
Internet Explorer does not properly handle an HTTP/1.1 302 redirect returned from a proxy server or Internet server when the HTTP/1.1 302 redirect is sent to Internet Explorer in two separate TCP frames (one with the HTTP/1.1 302 redirect, and the other with a HTML body containing a page for the new location).
Internet Explorer Returns Error Message When Being Redirected
Incredible. Not only is this for MSIE version FOUR but it still doesn't work properly for MSIE version FIVE.
Just gotta love MSIE …