Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 47871 invoked from network); 7 Jan 2002 16:51:56 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 7 Jan 2002 16:51:56 -0000 Received: (qmail 9857 invoked by uid 97); 7 Jan 2002 16:50:10 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 9733 invoked by uid 97); 7 Jan 2002 16:50:08 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 1903 invoked from network); 7 Jan 2002 05:55:43 -0000 Date: Sun, 6 Jan 2002 23:55:39 -0600 From: Kirby Vandivort To: Tomcat Users List Subject: Re: tomcat sending 200 response code instead of 404 when error-page used Message-ID: <20020106235538.A10124@ks.uiuc.edu> References: <20020103223105.A7932@ks.uiuc.edu> <3C389806.3040509@ev.co.yu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3C389806.3040509@ev.co.yu> User-Agent: Mutt/1.3.19i X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 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: 404 /404.html ) 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. 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. On Sun, Jan 06, 2002 at 07:31:34PM +0100, Nikola Milutinovic wrote: > Kirby Vandivort wrote: > > >Hello, > > > >I am using the 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 page? > > 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. > > Nix. > > > -- > To unsubscribe: > For additional commands: > Troubles with the list: -- Kirby Vandivort Theoretical Biophysics Group Email: kvandivo@ks.uiuc.edu 3051 Beckman Institute http://www.ks.uiuc.edu/~kvandivo/ University of Illinois Phone: (217) 244-5711 405 N. Mathews Ave Fax : (217) 244-6078 Urbana, IL 61801, USA -- To unsubscribe: For additional commands: Troubles with the list: