2.2.x patch: http://people.apache.org/~rpluem/patches/proxy-dns-patch_2.2.x.diff
+1: rpluem, wrowe, ylavic
- *) mod_proxy: Give ap_proxy_post_request as chance to act correctly on the status code
- by setting r->status temporarily to access_status. r->status might be different than
- access_status e.g. r->status could be HTTP_OK if e.g. we override the error page on
- the proxy or if the error was not generated by the backend itself but by the proxy
- e.g. a bad gateway.
- Trunk version of patch:
- http://svn.apache.org/r1597352
- Backport version for 2.2.x of patch:
- http://people.apache.org/~rpluem/patches/proxy_post_request_status_code.diff
- +1: rpluem, wrowe, ylavic
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
proxy_worker *worker = NULL;
int attempts = 0, max_attempts = 0;
struct dirconn_entry *list = (struct dirconn_entry *)conf->dirconn->elts;
+ int saved_status;
/* is this for us? */
if (!r->proxyreq || !r->filename || strncmp(r->filename, "proxy:", 6) != 0)
}
cleanup:
if (balancer) {
+ /*
+ * Save current r->status and set it to the value of access_status which
+ * might be different (e.g. r->status could be HTTP_OK if e.g. we override
+ * the error page on the proxy or if the error was not generated by the
+ * backend itself but by the proxy e.g. a bad gateway) in order to give
+ * ap_proxy_post_request a chance to act correctly on the status code.
+ */
+ saved_status = r->status;
+ r->status = access_status;
int post_status = proxy_run_post_request(worker, balancer, r, conf);
+ /*
+ * Only restore r->status if it has not been changed by
+ * ap_proxy_post_request as we assume that this change was intentional.
+ */
+ if (r->status == access_status) {
+ r->status = saved_status;
+ }
if (post_status == DECLINED) {
post_status = OK; /* no post_request handler available */
/* TODO: recycle direct worker */