Event source connections staying alive


I have an event source on my website and I’m noticing some inconsistencies on my production and development environment. On my development environment, the connection dies as soon as I close the window. On production (Cloudflare), if I close the window the connection stays alive for what appears to be 30-60 seconds. If I refresh the page 10 times back to back, then I’ll have tons of event source connections hogging up resources. How can I prevent Cloudflare from keeping this connection open? I suppose it would also be good to mention that this issue ONLY happens on Cloudflare + chrome. Firefox, Safari, and even iOS browsers close connections instantly. When running in development (non Cloudflare), chrome returns to normal behavior and closes connections instantly as well. Here are some headers:

nel: {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
cf-cache-status: DYNAMIC
cache-control: no-cache

Also noticing that Cloudflare is stripping my connection keep-alive header, but I read this does not have to much importance in modern day.


Looks to be an issue with http3, i disabled it and problem fixed itself.