diff --git a/crates/reqwest_client/src/reqwest_client.rs b/crates/reqwest_client/src/reqwest_client.rs index 3239a48904a..60908d8a8d4 100644 --- a/crates/reqwest_client/src/reqwest_client.rs +++ b/crates/reqwest_client/src/reqwest_client.rs @@ -30,6 +30,15 @@ impl ReqwestClient { reqwest::Client::builder() .use_rustls_tls() .connect_timeout(Duration::from_secs(10)) + // Detect and drop connections that have silently gone bad on a + // flaky path (NAT timeouts, resets) instead of reusing them. A + // stale reused HTTP/2 connection is a common source of + // `BadRecordMac` TLS errors against long-lived endpoints. + .tcp_keepalive(Duration::from_secs(30)) + .pool_idle_timeout(Duration::from_secs(30)) + .http2_keep_alive_interval(Duration::from_secs(15)) + .http2_keep_alive_timeout(Duration::from_secs(10)) + .http2_keep_alive_while_idle(true) } pub fn new() -> Self {