views:

45

answers:

1

I use Tomcat for hosting my web application and use apache http server on top of it using mod proxy for load balancing.

When my application throws a 404 or 500 error, I want to serve the error pages through apache http server rather than tomcat server. This is because I am serving all of my static content through apache and we don't want it as part of war. Is there a way I can do that? I couldn't find anything googling it.

+1  A: 

Specify the "ErrorDocument" directive in the virtualhost section of your apache config:

ErrorDocument 404 /path/to/my404page.html
ErrorDocument 500 /path/to/my500page.html

Additionally, since you're using mod proxy, you may you may wish to enable ProxyErrorOverride to let apache generate custom error documents for proxied content.

Also check out the documentation

Jeroen Rosenberg
Awesome. Thanks Jeroen. It works perfectly.
Ankit