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 2020/12/01 11:28:38 UTC

[Bug 64946] New: Websocket tunnel is created and stay opened even if the handshake failed

https://bz.apache.org/bugzilla/show_bug.cgi?id=64946

            Bug ID: 64946
           Summary: Websocket tunnel is created and stay opened even if
                    the handshake failed
           Product: Apache httpd-2
           Version: 2.4.46
          Hardware: Other
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: mod_proxy_wstunnel
          Assignee: bugs@httpd.apache.org
          Reporter: valentin.ozanne@gmail.com
  Target Milestone: ---

Hi,

We are facing a critical issue with mod_proxy_ws_tunnel : Websocket tunnel is
created and stay opened even if the handshake failed

Here is the observed behavior:

Assumptions: 
- Let’s assume httpd is configured as reverse proxy with 2 backends :
backend_websocket_1 and backend_2 
- The client is a browser that works with a reusable tcp/http connection pool.

Typical issue that occurred
- The Browser try to establish a websocket connection to /backend1
- backend_websocket_1 answers 500 instead 101 during websocket handshake (due
to temporary error)
- The browser received the 500 and considers the websocket connection as failed
- The browser reuse the same tcp connection to send others http requests to
backend_2
- The new http requests (to backend_2 for example) are not catched properly by
httpd and are directly forwarded to backend_websocket_1 (it seems they are
forwaded directly in the previously opened tunnel).

Additional notes: 
We succeeded to reproduce this behavior on many httpd version 2.4.46 included.
We also test the same scenario with an other reverse proxy (haproxy) and
everything works fine

-- 
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 64946] Websocket tunnel is created and stay opened even if the handshake failed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64946

vozman <va...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |valentin.ozanne@gmail.com

-- 
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 64946] Websocket tunnel is created and stay opened even if the handshake failed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64946

Yann Ylavic <yl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Yann Ylavic <yl...@gmail.com> ---
This is fixed in 2.4.47 and later by passing the upgrade=websocket parameter to
Proxy, see https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#protoupgrade

-- 
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 64946] Websocket tunnel is created and stay opened even if the handshake failed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64946

--- Comment #3 from Mohammed <mo...@gmail.com> ---
I tried to set this parameter upgrade=websocket next to my proxypass

However when I send a socket request of a such structure:
data1: websocket upgrade bad headers

data2: somedata

proxywstunnel wakes up from poll
sends data1
gets 400 from the backend socket
apache returns the 400 to the client

As soon as the client closes the socket

proxywstunnel wakes up again from poll and sends in data2 to the backend
socket.

I see that this problem is still in mod_proxy_wstunnel, if you log the
behaviour of proxy_wstunnel_handler

It doesn't exit or abort the connection when it gets 400 from the backend
socket in the begining of the handshake, it just continues the while loop as
!done still polls.

See https://bz.apache.org/bugzilla/show_bug.cgi?id=69538

-- 
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 64946] Websocket tunnel is created and stay opened even if the handshake failed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64946

Mohammed <mo...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mohammed.kraydiye@gmail.com

-- 
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 64946] Websocket tunnel is created and stay opened even if the handshake failed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64946

--- Comment #1 from vozman <va...@gmail.com> ---
Hi,
Does someone hava a feedback about it ?
Can we hope a fix quite soon ?

Thanks in advance

-- 
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