I have a slightly unusual setup where all content is retrieved via mod_proxy from various servers. However, to more clearly demonstrate the issue, I can simplify things to this configuration: ProxyErrorOverride On ErrorDocument 404 /404error.html RewriteEngine On RewriteRule (.*) http://backend.sever$1 [P] When requesting /whatever from this server, the initial request goes through to 'backend.server', which issues a 404 error. The frontend server then makes another request to 'backend.server' for '/404error.html'. backend.server has this file, so responds with an HTTP 200 response. The headend server now responds to the original request to /whatever, returning a HTTP 200 with the HTML for the error document.
Comparing the default_handler to the proxy_handler, the default_handler is respecting and not touching the r->status == 404 that is passed into the subrequest. In contrast in the proxy, proxy_run_scheme_handler() stomps on r->status, replacing the 404 with the 200 it got from the backend. Looks like the fix is to teach mod_proxy not to do that.
Created attachment 24976 [details] Fix for the problem The proxy_handler was overwriting r->status with the response code from the backend, which was then faithfully passed to the frontend. This patch works out when the original value should be maintained and passed to the client.
Fixed in r909899, proposed for backport to v2.2.