Bug 64946 - Websocket tunnel is created and stay opened even if the handshake failed
Summary: Websocket tunnel is created and stay opened even if the handshake failed
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_wstunnel (show other bugs)
Version: 2.4.46
Hardware: Other All
: P2 blocker (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-01 11:28 UTC by vozman
Modified: 2020-12-08 10:11 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vozman 2020-12-01 11:28:38 UTC
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
Comment 1 vozman 2020-12-08 10:10:01 UTC
Hi,
Does someone hava a feedback about it ?
Can we hope a fix quite soon ?

Thanks in advance