Firefox downloads custom 404 under IIS
April 20, 2005 3:17 PM   Subscribe

My custom 404 error page under IIS loads fine in IE, but firefox tries to download it instead of displaying it.

I'm guessing something to do with MIME type?

Also, nonexistant .php files don't get a 404 under either browser, but instead return "No input file specified."

Oh, IIS, how do I love thee, let me count the ways.
posted by CaptApollo to Computers & Internet (4 answers total)
 
IE will often try to display the page as HTML regardless of the content type, whereas Firefox is more loyal to the HTTP headers. What does "curl -I url" show?

As for the problem with non-existent files, I believe this is PHP's usual response when a requested file does not exist; what you need is to make IIS do the existence checking before it invokes PHP. That's what Apache, Lighttpd and other (better) web servers do.
posted by gentle at 3:27 PM on April 20, 2005


% telnet www.mydomain.com 80
GET /nonexistentpage.html HTTP/1.1
Host: www.mydomain.com

server sends back:
HTTP/1.1 200 OK
Date: Wed, 20 Apr 2005 22:19:12 GMT
Server: AOLserver/3.5.1
MIME-Version: 1.0
Content-Type: text/html
Content-Length: 2260
X-Cache: MISS from www.rustybrooks.com
Connection: close


You can do something similar for yourself on your server (using the right host, port, etc). It'll tell you the mime type it's returning.

IE often ignores the mime type and decides to interpret the data instead to see if it can figure out what it is. So yeah, it'll sometimes paper over such problems.

The above solution is crude and doesn't work for all things you want to try. I wrote a simple proxy server that spits out (to a log) everything the web browser sends to the server, and everything the server sends back. It's pretty useful. I don't know if such things are easily findable. If you want mine I can probably dig it up and post it on my website. I can build windows and unix versions. I could probably make OSX ones but I don't have access to an OSX box. I can post the source too (but you'll need Tcl to run it. Tcl is usually available on unix platforms, maybe mac too)
posted by RustyBrooks at 3:31 PM on April 20, 2005


Response by poster: Thanks folks, I figured out that while IIS was serving normal php files fine, my 404.php was properly getting jammed up in Firefox as I had not specified text/html for ANY php file (wonder why IIS was serving them. It says it won't in the dialog box!).

As for the nonexistant .php file, ideas on how to verify existance before PHP kicks in and gives the "no input file specified error?"

Thanks for the good info above!
posted by CaptApollo at 3:36 PM on April 20, 2005


As for the nonexistant .php file, ideas on how to verify existance before PHP kicks in and gives the "no input file specified error?"

You can set this through IIS:

right-click on the site and select properties, choose the "Home Directory" tab, and under the "Application Settings" section click on "Configuration", scroll down until you see the .php extension, edit that extension, and check the box next to "Verify that file exists".

Welcome to the joy of php on IIS. buy some spackling paste because before everything is over you'll probably punch some holes in the wall.
posted by fishfucker at 3:50 PM on April 20, 2005


« Older Tired of sex   |   Brain workouts Newer »
This thread is closed to new comments.