net/http/httputil: ReverseProxy: time out long-idle upgraded connections
#75830 opened on Oct 9, 2025
Description
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.