tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikola Milutinovic <>
Subject Re: tomcat sending 200 response code instead of 404 when error-page used
Date Sun, 06 Jan 2002 18:31:34 GMT
Kirby Vandivort wrote:

> Hello,
> I am using the <error-page> directive in my web.xml file to redirect
> users to an html file, /404.html.
> When I do this, though, it appears that tomcat is sending a response
> code of 200 instead of 404.  Is this the way that it should be?  It
> seems to me it should send a response code of 404 and then go ahead and
> send the contents of the 404.html file.
> Someone out there with a more recent knowledge of how http response
> headers are parsed can possibly set me straight on this one.

I think Apache is doing just what it's told - it is displaying a web page. There 
are several responses:

2xx - OK
3xx - Redirect (moved to a different location)
4xx - Client request error
5xx - Server error

So, at the error page, Tomcat has no way of knowing which type of error you wish 
to report and it is using the most common - "200 OK". After all, is it really 
important to the web browser what the code was, when it gets a nice custom error 

I know, there might be caching issues involved. Mostly with IE, I might add. And 
I might also add, if IE sees a 404 it might decide to jump in with IT'S OWN 
friendly error page, which totally opscures the real error page.

Anyway, you can always directly manipulate response object *in a JSP page and 
Servlet* Maybe there is some setting in web.xml, but I'm not sure.


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message