From 0a78aaed5f3905f684f8488a7156e485750856eb Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 29 Aug 2019 17:38:11 +0800 Subject: [PATCH] Added context to proxy request, fix when websocket close gRPC connection still alive; --- wsproxy/websocket_proxy.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wsproxy/websocket_proxy.go b/wsproxy/websocket_proxy.go index ada4c4e..3a82dfa 100644 --- a/wsproxy/websocket_proxy.go +++ b/wsproxy/websocket_proxy.go @@ -164,6 +164,8 @@ func (p *Proxy) proxy(w http.ResponseWriter, r *http.Request) { p.logger.Warnln("error preparing request:", err) return } + request = request.WithContext(ctx) + if swsp := r.Header.Get("Sec-WebSocket-Protocol"); swsp != "" { request.Header.Set("Authorization", transformSubProtocolHeader(swsp)) }