From cfa96d57158c17805d2f820a4de6156c2b293164 Mon Sep 17 00:00:00 2001 From: 1157987916 <42087738+1157987916@users.noreply.github.com> Date: Tue, 29 Dec 2020 16:21:03 +0800 Subject: [PATCH] update Sec-Websocket-Accept header when using more than one wss proxy ,need add Sec-Websocket-Accept header --- websocketproxy.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/websocketproxy.go b/websocketproxy.go index 63d39ba..9961dad 100644 --- a/websocketproxy.go +++ b/websocketproxy.go @@ -165,6 +165,9 @@ func (w *WebsocketProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if hdr := resp.Header.Get("Set-Cookie"); hdr != "" { upgradeHeader.Set("Set-Cookie", hdr) } + if hdr := resp.Header.Get("Sec-Websocket-Accept"); hdr != "" { + upgradeHeader.Set("Sec-Websocket-Accept", hdr) + } // Now upgrade the existing incoming request to a WebSocket connection. // Also pass the header that we gathered from the Dial handshake.