diff --git a/gateway/reverse_proxy.go b/gateway/reverse_proxy.go index a4bfc27b8e7..468e0ffb096 100644 --- a/gateway/reverse_proxy.go +++ b/gateway/reverse_proxy.go @@ -1381,7 +1381,7 @@ func (p *ReverseProxy) WrappedServeHTTP(rw http.ResponseWriter, req *http.Reques upgrade, _ := p.IsUpgrade(req) // Deal with 101 Switching Protocols responses: (WebSocket, h2c, etc) - if upgrade { + if upgrade && res.StatusCode == 101 { if err := p.handleUpgradeResponse(rw, outreq, res); err != nil { p.ErrorHandler.HandleError(rw, logreq, err.Error(), http.StatusInternalServerError, true) return ProxyResponse{UpstreamLatency: upstreamLatency}