Cloudflare WebSocket Connection Drops

Sanne Dejong 40 Reputation points
2026-09-25T15:59:53.64+00:00

Hi team,

Our long-lived WebSocket connections keep dropping every 100 seconds with close code 1006.

Could anyone advise on how best to configure Cloudflare's idle timeout settings alongside client/server keep-alive ping frames to stop this timing out?

Windows for business | Windows 365 Business
0 comments No comments

2 answers

Sort by: Oldest
  1. HLBui 13,020 Reputation points Independent Advisor
    2026-09-25T16:50:39.96+00:00

    Hi Sanne

    The 100‑second drop with code 1006 is almost always Cloudflare’s idle timeout kicking in. By default, Cloudflare closes WebSocket connections if they don’t see traffic for about that window. The trick is to configure keep‑alive pings from both client and server send a ping every 30–60 seconds and make sure the server replies with pong. That keeps the tunnel “active” in Cloudflare’s eyes. On top of that, check your Cloudflare idle timeout settings in the dashboard; depending on your plan, you can extend the limit beyond the default. Also make sure your origin server (like Nginx or IIS) has its own read timeout set longer than Cloudflare’s, otherwise you’ll still see drops. If you’re on Enterprise, you can ask Cloudflare support to bump the idle timeout higher, but for most setups, regular ping/pong frames are enough to keep connections alive.

    If this explanation helps you stabilize your WebSocket sessions, please hit “accept answer” so we know the response was useful

    Was this answer helpful?

    0 comments No comments

  2. HLBui 13,020 Reputation points Independent Advisor
    2026-09-29T03:14:29.9633333+00:00

    Please "Accept the answer" so that it could be spread further to those in need too. If not, is there anything I can help you with? Please let me know.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.