I have a site that uses a net/http based server. I recently configured
CloudFlare in front of it. (CloudFlare is a caching CDN-esque proxy that
tends to speed up sites and protects them from common web attacks) Much to
my surprise, I found my server with over 500 established connections to
various CloudFlare servers. After some investigation it appears that
http.Server is unable to timeout idle keep-alive connections. And
apparently, CloudFlare has a bug where they also never give up on an idle
connection. Strangely, they never give up on an idle connection even after
the original client closes their side of the connection. For now, I've set
a conservative ReadTimeout which should at least close the connections
after some time. But what I really want to do is to close the connection
when I know it has been idle for a short time. Any thoughts?
--