https://issues.apache.org/bugzilla/show_bug.cgi?id=49996
Summary: Proxied ErrorDocument returns 200 OK response code
Product: Apache httpd-2
Version: 2.2.15
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: mod_proxy_http
AssignedTo: [email protected]
ReportedBy: [email protected]
I want to reverse proxy error documents from a backend server (to keep them
consistent with the rest of the content/application proxied from there).
I tried the following reverse proxy configuration:
---------------------------
<Location /public>
ProxyPass http://backend:8080/public
</Location>
ErrorDocument 404 /public/404.html
---------------------------
... with backend:8080 configured to serve up a valid 404 document for
/public/404.html requests.
When I request a URL that does not exist on my reverse proxy, I get a 200 OK
response instead of a 404 response code, along with the correct error document
body from the backend. This is obviously confusing for caching, automation,
etc.
Evidently with a ProxyPass the response code from the backend is used as the
response code for the original request. Normally this would make sense, but not
when a response code has already been set and we're just getting content to go
with it. For reference, if instead we use a CGI script as the ErrorDocument and
don't specify a new response code, the original response code is retained.
This suggests a relatively simple approach: upon returning successfully from a
ProxyPass, check to see if the response already has a code, and leave it if so.
AFAICS the only scenario where this would make a difference is the one I've
described; in which case this handling offers the least surprising result.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]