0

As the title mentioned..

A little more detailed description of my usage:

I use Caddy as reverse proxy for aiohttp. And then Cloudflare in-front of Caddy. This is unrelated to Caddy, because using gray-clouded DNS entry (no proxy from Cloudfare) makes it work fine.

But whenever the traffic goes through Cloudflare, the websocket connection just dies after 2 minutes with 1006 closure code. No other message attached to the close frame.

I could reproduce it with the example websocket code snippet from the aiohttp documentation. (https://docs.aiohttp.org/en/stable/web_quickstart.html#websockets)

Tarek
  • 3
  • 1

1 Answers1

2

Hello fellow StackOverflow user Tarek. Please allow me to be the first to welcome you to the platform!

Though it is poorly documented, a few sources suggest Cloudflare will disconnect a WS session if it's idle for more than 100 seconds, unless you're an Enterprise customer -- in which case you can change the timeout duration within the Cloudflare control panel.

If you're not an Enterprise customer, you'll need to send a keep-alive of some sort in order to keep the socket open.

Hope this helps!

Dooley_labs
  • 206
  • 3
  • 7