You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Singleton <pa...@jbgb.com> on 2006/02/24 22:03:26 UTC

error-page for nonexistent context

(I am required to anonymiee a Tomcat 5.5 server from hackers
trying to discover its version etc.)

If I put this in conf/web.xml

 <error-page>
   <error-code>404</error-code>
   <location>/anon_error.jsp</location>
 </error-page>

*and* put an anon_error.jsp in every web app, then I can
replace the built-in error page.

But where will Tomcat look for /anon_error.jsp when a
(page within a) nonexistent context is requested?

Paul Singleton




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 268.0.0/268 - Release Date: 23/Feb/2006


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: error-page for nonexistent context

Posted by Glen Mazza <gr...@verizon.net>.
Paul Singleton wrote:

> (I am required to anonymiee a Tomcat 5.5 server from hackers
> trying to discover its version etc.)
> 
> If I put this in conf/web.xml
> 
> <error-page>
>   <error-code>404</error-code>
>   <location>/anon_error.jsp</location>
> </error-page>
> 
> *and* put an anon_error.jsp in every web app, then I can
> replace the built-in error page.
> 
> But where will Tomcat look for /anon_error.jsp when a
> (page within a) nonexistent context is requested?

e.g., http://localhost:8080/skldjfha ?

Then I think you would want to alter the conf/web.xml for the 
DefaultServlet[1], placing the <error-page/> element you have defined 
above in that file.

[1] http://tomcat.apache.org/tomcat-5.5-doc/default-servlet.html

Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: error-page for nonexistent context

Posted by Paul Singleton <pa...@jbgb.com>.

Mark Thomas wrote:
> Paul Singleton wrote:
>> (I am required to anonymiee a Tomcat 5.5 server from hackers
>> trying to discover its version etc.)
>>
>> If I put this in conf/web.xml
>>
>> <error-page>
>>   <error-code>404</error-code>
>>   <location>/anon_error.jsp</location>
>> </error-page>
>>
>> *and* put an anon_error.jsp in every web app, then I can
>> replace the built-in error page.
>>
>> But where will Tomcat look for /anon_error.jsp when a
>> (page within a) nonexistent context is requested?
> 
> I haven't tested this...
> 
> I would expect an unknown context to be mapped to the ROOT context
> given the mapping rules defined in section SRV.11.1
> 
> If the context isn't recognised, then the longest macthing context
> path will be "/" which is the ROOT context.

Thanks for this: I think you're right, and I have now tested
this in 5.5.9 (which of course is not necessarily the version
I'm trying to anonymise :-) and it works.

cheers - Paul S.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: error-page for nonexistent context

Posted by Mark Thomas <ma...@apache.org>.
Paul Singleton wrote:
> (I am required to anonymiee a Tomcat 5.5 server from hackers
> trying to discover its version etc.)
> 
> If I put this in conf/web.xml
> 
> <error-page>
>   <error-code>404</error-code>
>   <location>/anon_error.jsp</location>
> </error-page>
> 
> *and* put an anon_error.jsp in every web app, then I can
> replace the built-in error page.
> 
> But where will Tomcat look for /anon_error.jsp when a
> (page within a) nonexistent context is requested?

I haven't tested this...

I would expect an unknown context to be mapped to the ROOT context
given the mapping rules defined in section SRV.11.1

If the context isn't recognised, then the longest macthing context
path will be "/" which is the ROOT context.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org