Ankit Bansal
Ankit Bansal

Reputation: 5072

Serve Error Pages Using Apache HTTP Server

I am using Tomcat for hosting my web application and 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 don't want it as part of war. Is there a way to do that?

Upvotes: 3

Views: 2331

Answers (1)

Jeroen Rosenberg
Jeroen Rosenberg

Reputation: 4690

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

Upvotes: 2

Related Questions