Intermittent errors with WebSockets

We recently add Cloudflare to the frontend of our AWS Application Load Balancer.

The backend app servers run websockets for RabbitMQ connections. Some of our users are seeing intermittent errors/problems when going through Cloudflare. Such as–

• WebSocket connection to 'wss://mydomain.com/socket.i' failed.:
Error during Websocket handshake: Unexpected response code: 400

• Error 521

• Slow network is detected.

Most commonly, the users experiencing these problems are in the Philippines. Our AWS app servers are in US E. Virginia. So far, I haven’t been able to recreate the problems as a US user. No one has experienced these errors when going directly to our AWS Load Balancer URL.

I confirmed Network>Websockets are enabled for our account. Our CloudFlare plan is Pro, which allows Medium concurrent Websocket connections. We aren’t currently experiencing large amounts of traffic.

Any advice would be appreciated.

Hello,
I would recommend you to make sure you implement a mechanism so that the client side keep the connection active, and attempt to reconnect if needed.

Error 521 occurs when the origin refuses the connection from the Cloudflare datacenters.
I would recommend you to make sure that all Cloudflare IPs are allowed on the origin side, and not rate-limited:


This topic was automatically closed after 30 days. New replies are no longer allowed.