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 2022/02/14 11:57:20 UTC
[Bug 65881] New: HTTP2 module uses wrong port after upgrade in proxy scenario
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
Bug ID: 65881
Summary: HTTP2 module uses wrong port after upgrade in proxy
scenario
Product: Apache httpd-2
Version: 2.4.52
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: mod_http2
Assignee: bugs@httpd.apache.org
Reporter: al.httpd_questions@yahoo.com
Target Milestone: ---
Created attachment 38188
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38188&action=edit
HTTPD logs from proxy
I'm setting up a following configuration (note, this is not intended for
browser usage):
Client(curl) --h2c--> Proxy(httpd) --h2--> Server(httpd)
Proxy is set up as a gateway with dynamic detection of the host name for the
proxy target as follows:
<VirtualHost *:8181>
Protocols h2c
RewriteEngine On
RewriteRule "^/(.*)$" "h2://%{HTTP_HOST}/$1" [NC,P]
ProxyPassMatch / "h2://$1/"
</VirtualHost>
After executing this curl command I get 503 reply from the proxy:
curl -v --http2 --proxy localhost:8181 http://backend-http:443
From the logs I can see that first request is processed correctly, e.g. Host
header is set to `backend:443`, as seen here:
[Mon Feb 14 10:58:43.891364 2022] [core:trace5] [pid 2413:tid 139733598463744]
protocol.c(711): [client 172.18.0.1:59934] Request received from client: GET
http://backend-http:443/ HTTP/1.1
[Mon Feb 14 10:58:43.891475 2022] [http:trace4] [pid 2413:tid 139733598463744]
http_request.c(438): [client 172.18.0.1:59934] Host: backend-http:443
then, upgrade to HTTP/2 is happening,
[Mon Feb 14 10:58:43.892103 2022] [http2:trace1] [pid 2413:tid 139733598463744]
h2_switch.c(150): [client 172.18.0.1:59934] switching protocol to 'h2c'
client confirms it,
[Mon Feb 14 10:58:43.892333 2022] [http2:debug] [pid 2413:tid 139733598463744]
h2_session.c(339): [client 172.18.0.1:59934] AH03066: h2_session(66,INIT,0):
recv FRAME[SETTINGS[length=18, stream=0]], frames=0/0 (r/s)
[Mon Feb 14 10:58:43.892343 2022] [http2:trace2] [pid 2413:tid 139733598463744]
h2_session.c(420): [client 172.18.0.1:59934] h2_session(66,INIT,0): SETTINGS,
len=18
and then httpd tries to establish a connection to the target backend server,
but, the port number is switched from the original 443 to 8181 (which is of the
virtual host):
[Mon Feb 14 10:58:43.892407 2022] [http2:debug] [pid 2413:tid 139733598463744]
h2_stream.c(620): [client 172.18.0.1:59934] AH03058: h2_stream(66-1,IDLE):
set_request_rec GET host=http://backend-http:8181/
And this of course fails, as the target server is not listening on port 8181.
Expected behavior for this case would be that httpd uses the original port
number from the request.
--
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
[Bug 65881] HTTP2 module uses wrong port after upgrade in proxy scenario
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
--- Comment #1 from Alexey Larikov <al...@yahoo.com> ---
Created attachment 38189
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38189&action=edit
Curl logs
--
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
[Bug 65881] HTTP2 module uses wrong port after upgrade in proxy scenario
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
--- Comment #2 from Stefan Eissing <ic...@apache.org> ---
Created attachment 38194
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38194&action=edit
proposed patch and test case
--
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
[Bug 65881] HTTP2 module uses wrong port after upgrade in proxy scenario
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
Stefan Eissing <ic...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #5 from Stefan Eissing <ic...@apache.org> ---
Fixed in trunk r1898146. Proposed for backport to 2.4.x.
--
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
[Bug 65881] HTTP2 module uses wrong port after upgrade in proxy scenario
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
Stefan Eissing <ic...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #3 from Stefan Eissing <ic...@apache.org> ---
Nice catch. Indeed, the request was forwarded via the server's port and not
with the port given in the request.
Please check proposed patch and test which reproduces/fixes the issue for me.
Thanks.
--
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
[Bug 65881] HTTP2 module uses wrong port after upgrade in proxy scenario
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
--- Comment #4 from Alexey Larikov <al...@yahoo.com> ---
Created attachment 38195
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38195&action=edit
(patched version) HTTPD logs from proxy
With the patch it works as expected. Logs attached.
Thanks for quick fix.
--
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
[Bug 65881] HTTP2 module uses wrong port after upgrade in proxy scenario
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65881
Alexey Larikov <al...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--
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