Mongrel Patch - Fixes 404 Error in IE


Using Mongrel has been great. Thank you Zed for developing such a fine
of software.

For some reason, when using IE to access a Rails app running on a
server, I get a 404 error. This is an intermittent error and does not
on all machines.

Upon further investigation, we noticed that IE sends a
GET http://localhost:3000/path/to/file
instead of
GET /path/to/file

This causes Mongrel to send back a 404, without sending the request to
Rails. It seems the GET http://localhost:3000/path/to/file does not map
the proper handler.

We looked in the RFC (section 5.2),
HTTP/1.1: Request, and it seems to
indicate that the web server should ignore the host part of an absolute
in the GET request. Am I correct on this?

I created a bug report at
and a patch to fix it at

Has this been an issue for anybody else?

Zed or anybody on the Mongrel core team, if you see this, please take a
at the patch.

Brian T.

On Wed, 2006-07-26 at 16:25 +0900, Brian T. wrote:

Zed or anybody on the Mongrel core team, if you see this, please take a look
at the patch.

Brian, I’ve been watching your patch and bug reports but haven’t had
time to deal with them just yet. Next week I’ll be attacking the bug
list and doing a release.

BTW, your patch has a potential buffer overflow in two directions.
There’s a simpler fix I’ll do in the parser, but use your patch to get
you over the hump until I make it. Basically, strstr and then searching
for a “/” without any sizes will cause nasty things.

Also, Mongrel doesn’t really recognize URLs like this since it’s not
doing vhosts or anything, so the real question is why IE is sending this
crap. I’ll add the patch since frankly you can’t fight IE, but there’s
got to be a reason IE is sending this. I use IE in testing all the
time and never had this happen.

Maybe it’s that stupid localhost:3000 vs. http://localhost:3000 thing
(try typing both into IE and see if one works but the other doesn’t)?


Thank you Zed!!