Critical - Websockets are not functioning
See original GitHub issue@chhsiao90 This is more of a critical issue. Please try https://www.chess.com/play/online with and without the proxy. Play as a guest. Without proxy works fine but without the proxy, the game doesn’t start.
One of the web socket requests never receives a response (see request below). This looks like an upgrade to WebSocket request but doesn’t get a response back.
Request URL: wss://services.chess.com/pubsub?uid=60effee6-29cc-11eb-a8b6-45984bd698ca&client_type=web&client_version=1.1.0&client_id=Q6QnQaZU
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: Upgrade
Host: services.chess.com
Origin: https://www.chess.com
Pragma: no-cache
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Key: oa5/OszTx/rzQ8y9Y1r/rg==
Sec-WebSocket-Version: 13
Upgrade: websocket
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Query String:
uid: 60effee6-29cc-11eb-a8b6-45984bd698ca
client_type: web
client_version: 1.1.0
client_id: Q6QnQaZU
It goes to the forward handler I believe with the following issues:
13:30:25.004 [nioEventLoopGroup-3-8] DEBUG c.g.c.n.h.p.h.Http1BackendHandler - [Client (kubernetes.docker.internal:63798)] <=> [Server (services.chess.com:443)] : handlerAdded 13:30:25.005 [nioEventLoopGroup-3-8] DEBUG c.g.c.n.h.p.tls.TlsBackendHandler - [Client (kubernetes.docker.internal:63798)] <=> [Server (services.chess.com:443)] : handlerRemoved 13:30:25.018 [nioEventLoopGroup-3-8] DEBUG c.g.c.n.h.ForwardFrontendHandler - [Client (kubernetes.docker.internal:63798)] <=> [Server (services.chess.com:443)] : handlerAdded 13:30:25.019 [nioEventLoopGroup-3-8] DEBUG c.g.c.n.h.p.tls.TlsFrontendHandler - [Client (kubernetes.docker.internal:63798)] <=> [Server (services.chess.com:443)] : handlerRemoved 13:30:25.020 [nioEventLoopGroup-3-8] DEBUG c.g.c.n.listener.ForwardEventLogger - 474554202f7075627375623f7569643d6164...... (continues) 13:30:25.026 [nioEventLoopGroup-3-8] DEBUG c.g.c.n.h.ForwardFrontendHandler - [Client (kubernetes.docker.internal:63798)] <=> [Server (services.chess.com:443)] : PooledUnsafeDirectByteBuf(ridx: 0, widx: 1017, cap: 1039)
We need to detect HTTP protocol on the backend I believe the issue is that ALPN fails on the back end but has a value on the front end I think. Regardless of what the ALPN outcome is on the back-end, I think we should still read a few bytes of data to make sure we are not missing an HTTP protocol vs. just forwarding it to the forwardhandler on ALPN failure.
Should we capture websocket frames? Either way, I think it would be specifically good to intercept WebSocket requests to detect traffic as chats etc.
- Detect connection upgrade and if the the upgrade is websocket “Upgrade”.equalsIgnoreCase(headers.get(HttpHeaderNames.CONNECTION)) && “WebSocket”.equalsIgnoreCase(headers.get(HttpHeaderNames.UPGRADE)
- Add a websocket handler and perform the websocket handshake (front and back end) on agreed upon sub protocol
- Handle the WebSocketFrames in the handler including WebSocketFrame, read and intercept websocket text and binary frames and be able to handle those intercepts as well. Perhaps all we need is a onWebSocketSend(WebSocketFrame) and onWebSocketReceive(WebSocketFrame).
Please let me know if that works. This is the only main pending issue on my end at the moment.
Thanks, Abbas
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Supporting websocket should be the roadmap of nitmporxy. I can check and make the forward handler work before the websocket handle implemented.
HI @abbasvalliani - v1.3.4 just released!