fixup! fixup! fixup! fixup! fixup! fixup! Update go.mod and go.sum

This commit is contained in:
2025-11-05 21:56:29 +00:00
parent 2966661054
commit fd30dc0890
+12 -1
View File
@@ -90,8 +90,14 @@ func (wsp *WebSocketProxy) HandleWebSocket(c *fiber.Ctx) error {
// Capture headers from the upgrade request to forward to backend
headers := make(http.Header)
var subprotocols []string
for key, value := range c.Request().Header.All() {
keyStr := string(key)
// Capture subprotocol separately
if keyStr == "Sec-Websocket-Protocol" || keyStr == "Sec-WebSocket-Protocol" {
subprotocols = append(subprotocols, string(value))
}
// Forward important headers including WebSocket subprotocol
// Skip only connection-establishment headers that will be regenerated
if keyStr != "Connection" && keyStr != "Upgrade" &&
@@ -101,11 +107,16 @@ func (wsp *WebSocketProxy) HandleWebSocket(c *fiber.Ctx) error {
}
}
// Configure WebSocket with subprotocol support
config := websocket.Config{
Subprotocols: subprotocols,
}
return websocket.New(func(clientConn *websocket.Conn) {
// Use background context for long-lived WebSocket connections
// The original request context expires after the upgrade
wsp.handleConnection(context.Background(), clientConn, headers)
})(c)
}, config)(c)
}
// handleConnection manages a single WebSocket connection