• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Overriding Tomcat Error Pages with Httpd

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to override a tomcat error page with apache httpd pages based on the http status code in the response. I do not want to use error pages in the war file specified in the web.xml. I only need the error code from the application. This is done using HttpServletResponse.sendError();.

Unfortunatly in nearly every situation, the tomcat error is displayed.

The code contains the following:

ProxyErrorOverride on

ErrorDocument 404 "Not found 404"
ErrorDocument 500 "Internal Server Error 500"
ErrorDocument 503 "Temp Unavailable 503"

This works in an environment where ProxyPass, ProxyPassRevere, ProxyPassReverseCookiePath are used.

However, when no reverse proxy is specified, I cannot get apache to override the tomcat prepared error pages.

Any suggestions would be greatly appreciated.
 
Saloon Keeper
Posts: 24321
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Alan!

I don't really see the virtue of that - in fact a lot of times the difference between the Tomcat 404 and Apache 404 pages has clued me in to proxying problems. However...

Probably the simplest way to "replace" these pages is to simply steal copies of the Apache page templates, put them into your WAR and set the error page resource locations in WEB-INF/web.xml.

Note that even in straight Apache without Tomcat those pages are merely defaults and can be (and often are) replaced by custom error pages.
 
reply
    Bookmark Topic Watch Topic
  • New Topic