question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

  1. Detect connection upgrade and if the the upgrade is websocket “Upgrade”.equalsIgnoreCase(headers.get(HttpHeaderNames.CONNECTION)) && “WebSocket”.equalsIgnoreCase(headers.get(HttpHeaderNames.UPGRADE)
  2. Add a websocket handler and perform the websocket handshake (front and back end) on agreed upon sub protocol
  3. 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:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chhsiao90commented, Jun 8, 2021

Supporting websocket should be the roadmap of nitmporxy. I can check and make the forward handler work before the websocket handle implemented.

0reactions
chhsiao90commented, Jun 10, 2021

HI @abbasvalliani - v1.3.4 just released!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting WebSocket - Wrike Help Center
Check that WebSocket is working · Open Wrike's Support Tool. · Under Access to Wrike Transport, if it says Success that means WebSocket...
Read more >
WebSocket Security: Top 8 Vulnerabilities and How to Solve ...
Learn about critical WebSocket security threats such as DoS, man in the middle and weak authentication, and discover how to defend against them....
Read more >
the request of a dependency is an expression · Issue #106 ...
When i build angular universal, I get this error. Please help me. /node_modules/node-gyp-build/index.js. Critical dependency: the request of ...
Read more >
WebSocket connection to 'wss://...' failed. ASP .Net Core Web ...
The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not...
Read more >
Error with WebSocket - Microsoft Q&A
Hello I get the error: WebSocket connection to 'wss://localhost:54970/Dashboard.Server/' failed: Error in connection establishment: net::ERR_ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found