How do I configure Apache to redirect 404 errors to a Tomcat servlet, without losing any POSTed form data from the original request?

Alessandro A. Garbagnati

According to the Apache documentation the ErrorDocument configuration directive should be used exactly for this purpose.

The documentation is located at http://httpd.apache.org/docs/mod/core.html#errordocument", and in the http.conf.default file that is generated during the installation there are a few examples:

# Customizable error response (Apache style)
#  these come in three flavors
#    1) plain text
#ErrorDocument 500 "The server made a boo boo.
#  n.b.  the single leading (") marks it as text, it does not get output
#    2) local redirects
#ErrorDocument 404 /missing.html
#  to redirect to local URL /missing.html
#ErrorDocument 404 /cgi-bin/missing_handler.pl
#  N.B.: You can redirect to a script or a document using server-side-includes.
#    3) external redirects
#ErrorDocument 402 http://some.other_server.com/subscription_info.html
#  N.B.: Many of the environment variables associated with the original
#  request will *not* be available to such a script.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.