Protected web socket connection dies after 30 secs - Cloudflare IPv6 issue

Hello, I've been recently developing a web application in my spare time for the past few months. After deploying it to Cloudflare I discovered a potential issue with Cloudflare proxying WebSocket connections. My application operates a Socket.IO server [behind CF SSL] for event-based communication, and I noticed that once deployed to Cloudflare the connection dies after around 30~ seconds with the reason 'transport close'. After investigating, I found that this is an issue with Cloudflare, and only happens on IPv6 connections [at least with my ISP - BT UK]. To investigate this issue, I modified my Windows 'host' file to direct the [protected] subdomain with the socket.io server to three different IPs. the first IP was just the server's IP [without Cloudflare] which worked fine, I did this again but with an IPv4 Cloudflare IP which also worked fine. I then did an IPv6 Cloudflare IP which the disconnection issue occurs on. To make sure this isn't just an issue with my device, I tried accessing the site on multiple devices within my own LAN, resulting in the same outcome. Additionally what's strange is that although after a 20-second or so period, the server no longer acknowledges packets being sent from the client, yet still isn't 'dead' as it continues with socket.io's heartbeat until it gives up as it considers no response sent. Thanks, Jack
No description
No description
2 Replies
jake4
jake4OP2y ago
Update: I temporarily solved this Issue by disabling IPv6 (Network -> IPv6 Compatibility) though the API
Chaika
Chaika2y ago
The factor you haven't excluded yet is your ISP/router/etc, I would be curious if you used your host file to override it to directly connect to your server over IPv6, and also if using IPv6 -> Cloudflare from hotspot/a different ISP (or maybe a VPN), would be worthwhile tests to better isolate it to being proxy behavior

Did you find this page helpful?