Hello, When a target web site being connected to through a proxy server has a rewrite with no content in the body, the proxy server closes the connection before sending any headers. In my case, I can't control the target site and have to rely on the proxy server to gracefully handle a redirect like this. An example can be seen with this bit of php code on the target site that the proxy server proxies to. Put this into the document root as index.php so that a GET request for / will execute it: <?php header ('Location: http://mytargethost.com/test.html'); ?> Connecting directly to mytargethost.com will return headers with no body content, which is the expected behavior when connecting through the proxy server: telnet mytargethost.com 80 Trying 192.168.1.2... Connected to mytargethost.com (192.168.1.2). Escape character is '^]'. GET / HTTP/1.0 User-Agent: Wget/1.11.4 Red Hat modified Accept: */* Host: mytargethost.com HTTP/1.1 302 Moved Temporarily Date: Sat, 25 Feb 2012 03:47:08 GMT Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8q DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Location: http://mytargethost.com/test.html Content-Length: 0 Connection: close Content-Type: text/html But the proxy server drops the connection before sending any headers: $ telnet myproxyhost.com 80 Trying 192.168.1.1... Connected to myproxyhost.com (192.168.1.1). Escape character is '^]'. GET /mytargethost.com/ HTTP/1.0 User-Agent: Wget/1.11.4 Red Hat modified Accept: */* Host: myproxyhost.com Connection closed by foreign host. Here is the relevant Apache configuration on the proxy server: ProxyHTMLEnable On ProxyHTMLLinks a href ProxyPass /mytargethost.com http://mytargethost.com <Location /mytargethost.com/> ProxyHTMLURLMap / /mytargethost.com/ </Location> This patch fixed the problem for me on httpd 2.4.1: --- mod_proxy_html.c 2012-02-24 17:45:53.000000000 -0600 +++ mod_proxy_html-patched.c 2012-02-24 17:51:53.000000000 -0600 @@ -947,6 +947,10 @@ } } /*ap_fflush(ctxt->f->next, ctxt->bb); // uncomment for debug */ + + if ( ctxt->parser == NULL ) /*If no processing was done, simply pass the brigade.*/ + return ap_pass_brigade(f->next, bb) ; + apr_brigade_cleanup(bb); return APR_SUCCESS; } Best regards, Mike Streeter
Thanks for the detailed bug report. But actually, I think this is a bug in mod_xml2enc. Can you verify that this patch fixes the problem for you? http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_xml2enc.c?r1=1293717&r2=1293716&pathrev=1293717
I tested your patch, and it fixes the problem for me. Thanks!