mod_proxy hangs when both KeepAlive and ProxyErrorOverride are enabled, and a non-200 response without a body is generated by the backend server.
(e.g.: a client makes a request containing the "If-Modified-Since" and "If-None-Match" headers, to which the backend server respond with status 304.) The following patch corrects this: --- proxy_http.c 1 Jan 2004 13:26:21 -0000 1.176 +++ proxy_http.c 8 Jan 2004 18:24:09 -0000 @@ -992,7 +992,13 @@ */ int status = r->status; r->status = HTTP_OK; - ap_discard_request_body(rp); + /* Discard body, if one is expected */ + if ((status > 199) && /* not any 1xx response */ + (status != HTTP_NO_CONTENT) && /* not 204 */ + (status != HTTP_RESET_CONTENT) && /* not 205 */ + (status != HTTP_NOT_MODIFIED)) { /* not 304 */ + ap_discard_request_body(rp); + } return status; } } else Extra details for those who care: Conditions: - mod_proxy acting as a forward or reverse proxy - KeepAlive On - ProxyErrorOverride On - Persistent connection to backend server - backend server responds with a non-200 status - backend server does not send a body Details: In proxy_http.c, ap_discard_request_body() is called on a request with a non-200 status when ProxyErrorOverride is enabled. ap_discard_request_body() eventually calls ap_http_filter() which, when called with a proxy response request_rec, attempts to read a body even when there is no indication that one exists (response bodies can be terminated with a connection close, instead of using a CL header or chunked encoding). However, on a persistent connection to the backend, the read blocks until a timeout occurs (apr_wait_for_io_or_timeout()). (This patch was originally submitted by Graham Wiseman <gwiseman AT fscinternet.com>, but hasn't been committed...) Thanks, Richard