On Thu, 2002-10-24 at 16:24, Kristj�n Bjarni Gu�mundsson wrote:
> I use custom error pages for various error codes (404. etc),  all of them 
> work except 401 error.
> 
> If I go to a protected page the browser just displays the 401 page without 
> prompting me
> to log in. What am I doing wrong?

Short answer: nothing

Tomcat sends that pages with response code 200. I consider this a bug.

If You want tomcat to send You 401-page with a 401 code You have to
use a JSP which sets the response code manually:

...
<% response.setStatus(response.SC_UNAUTHORIZED);
   response.setHeader("WWW-Authenticate", "BASIC realm=\"restricted\"");
%>
...

It is a hack but at least it is working.

hth,

Hans


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to