On Sun, 6 Jan 2002, Kirby Vandivort wrote:
> Date: Sun, 6 Jan 2002 23:55:39 -0600
> From: Kirby Vandivort <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: tomcat sending 200 response code instead of 404 when
> error-page used
>
> Thanks for the response, but let me be a bit more specific in my
> question. I am using tomcat 4.0.1 standalone, so apache is not
> involved.
>
> Tomcat utilizes the <error-page> directive when it DOES realize that
> there has been a problem in the code, and the error-page directive has
> an error-type parameter that tells it the exact type of error that it
> needs to utilize that particular error-page for. (something like:
> <error-page>
> <error-type>404</error-type>
> <location>/404.html</location>
> </error-page> )
>
> So, I have set up an error-page directive in my web.xml file to tell
> tomcat that it needs to do something special for 404s. Tomcat is then
> sending a response code of 200 and the 404.html file, rather than a
> response code of 404 and the html file.
>
That is the correct behavior, from my understanding. Declaring an
<error-page> is telling the container to "use this page *instead* of what
you would normally do". And, because your "/404.html" page actually
exists, a 200 is the correct status for that.
> For my particular case it happens to be important what the response
> code is, because it isn't a browser that is requesting the file. It is
> a program that does something special if it gets a 404 as opposed to a
> 200. So, it needs to be a 404. (for those that are curious, the
> 'program' is a JVM; when running an applet it will try to request class
> files from the server; if it gets a 404 it knows that it can't find the
> class. If it gets a 200, it thinks that the html file is the binary of
> the class file and gets really confused.)
>
> Hope this helps make it more clear.
>
Why not just remove your <error-page> declaration? Then, Tomcat will
return a "real" 404 status?
Craig McClanahan
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>