You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2012/02/25 05:08:28 UTC
DO NOT REPLY [Bug 52766] New: mod_proxy_html connection dropped when
back end redirects with headers only
https://issues.apache.org/bugzilla/show_bug.cgi?id=52766
Bug #: 52766
Summary: mod_proxy_html connection dropped when back end
redirects with headers only
Product: Apache httpd-2
Version: 2.4.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: mod_proxy
AssignedTo: bugs@httpd.apache.org
ReportedBy: mstreeter1@gmail.com
Classification: Unclassified
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
--
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 52766] mod_proxy_html connection dropped when back
end redirects with headers only
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52766
Michael Streeter <ms...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mstreeter1@gmail.com
--
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 52766] mod_proxy_html connection dropped when back
end redirects with headers only
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52766
--- Comment #2 from Michael Streeter <ms...@gmail.com> 2012-02-28 01:18:13 UTC ---
I tested your patch, and it fixes the problem for me. Thanks!
--
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 52766] mod_proxy_html connection dropped when back
end redirects with headers only
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52766
Stefan Fritsch <sf...@sfritsch.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |FixedInTrunk
--- Comment #1 from Stefan Fritsch <sf...@sfritsch.de> 2012-02-25 22:55:09 UTC ---
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
--
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 52766] mod_proxy_html connection dropped when back
end redirects with headers only
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52766
Michael Streeter <ms...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 52766] mod_proxy_html connection dropped when back
end redirects with headers only
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52766
Rainer Jung <ra...@kippdata.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|mod_proxy |mod_xml2enc
--
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org