golang/go

net/http/httputil: ReverseProxy: time out long-idle upgraded connections

开放

#75,830 创建于 2025年10月9日

 (5 条评论) (0 个反应) (0 位负责人)Go (19,008 个派生)batch import
LibraryProposalNeedsDecisionhelp wanted

仓库指标

星标
 (133,883 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

ReverseProxy automatically handles upgraded connections, such as WebSocket connections. When a proxied request results in a 101 Switching Protocols response, ReverseProxy switches to proxying raw bytes through the connection.

We should perhaps have some form of idleness detection, so a dead connection isn't left around consuming resources indefinitely. Currently, if one half of the connection vanishes without closing the TCP connection, ReverseProxy will leave the connection active until the OS times out the connection.

This probably needs to be off by default, since I'm certain someone is depending on ReverseProxy proxying long-lived but mostly-idle connections.

Since this will need to be configurable, it'll need to go through the proposal process once there's a concrete design for the configuration knob.

贡献者指南