cloudflare / cloudflare/cloudflared

Stop TCP connections from lingering for 60 seconds

Open
#97 1 comment 0 reactions 1 assignee Claimed by @acmacalister View on GitHub
Confirmed
Dominant language
Go
Stars
15.6k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

When `cloudflared` is used for plain TCP tunnels (`ssh://` and `rdp://` URLs), the connections to the server stay open and idle for 60 seconds after the client has closed the TCP connection on its end. This was probably originally meant for utilizing HTTP Keep-alive connections, but it doesn't make sense with non-HTTP traffic. I suspect these lingering open connections were the reason why we saw calls to our API getting stuck over Argo tunnel after lots of short-lived connections, which were not so short-lived on the server side.

By experimenting a bit, I found that [here is the hard-coded value](https://github.com/cloudflare/cloudflared/blob/137928ecafec1ee98abc46377e07ce046b6b3e45/websocket/websocket.go#L23) (`pongWait`) that specifies how long the connections stay open. If it still makes sense to keep them open when HTTP proxying, maybe there should be an option to set it from the command line, and/or it should be set to 0 when proxying to `ssh://` and `rdp://` URLs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.