Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache mod-proxy ProxyErrorOverride for specific URL patterns

I am using Apache 2.2 with mod-proxy and I have configured it with several ProxyPass statements to proxy from remote URL to local URL. I need to have custom error documents returned from Apache for these proxied URLs so I set "ProxyErrorOverride On" in my mod-proxy configuration along with some ErrorDocument directives (with local URL path) to return custom error pages for a few HTTP status codes of interest. However, when a status code is returned for which I have NOT created an ErrorDocument directive for, Apache replaces the response body with a default error page instead of leaving the original response body intact. This won't work with the application. So I really have 2 questions:

1) Is it possible to configure Apache to leave the original response body intact for a particular status code if I don't have an ErrorDocument override defined for it?

2) Is it possible to have the ProxyErrorOverride directive only apply to some of the URLs in my ProxyPass statements?

like image 597
benw Avatar asked Sep 28 '11 19:09

benw


1 Answers

As arober11 pointed out in the comment above:

Afraid the answer is: No and No. If the directive could be limited to a location, directory, or set of URL's, then there would be something in the "Context" section, of the man page: httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyerroroverride

on the other hand: you can always add it to mod_proxy.c yourself.

like image 52
bjelli Avatar answered Oct 02 '22 13:10

bjelli