ErrorDocument when using Apache as reverse-proxy

apache-2.2reverse-proxy

'evening,

I have an Apache server (2.2.19) and a 4D Webstar server (kinda unknown HTTP server) on the same physical server. Apache only listens the SSL port (443) and is used as a reverse-proxy to 4DW (through a SSL VHost).

Here are the two proxy directives I use :

ProxyPass / http://127.0.0.1:xxxx/ timeout=15 connectiontimeout = 15
ProxyPassReverse / http://127.0.0.1:xxxx/

Given the fact that the 4DW server can go offline from time to time, i'd like to have a custom 503 error page to notify the users of the downtime or maintenance of the back-end app.
Except Apache redirects everything from /htdocs/ (which is the documentroot) and we need quick access to the errordocument to edit it when needed (thus, an external errordoc is not an option).

Is there any way to force Apache not to proxy a given directory (let's say htdocs/error/), or any solution at all as to using an errordocument outside of the DocumentRoot?

Cheers

Best Answer

Sure, just exclude it from the ProxyPass rules. These are evaluated in order, so make sure the exclusion is on top:

ErrorDocument 503 /error/503.html
ProxyPass /error/ !
ProxyPass / http://127.0.0.1:xxxx/ timeout=15 connectiontimeout = 15
ProxyPassReverse / http://127.0.0.1:xxxx/