@@ -10,7 +10,6 @@ import (
1010 "github.com/mbland/hmacauth"
1111 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
1212 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
13− "github.com/yhat/wsutil"
1413)
1514
1615const (
@@ -156,14 +155,12 @@ func setProxyDirector(proxy *httputil.ReverseProxy) {
156155
157156// newWebSocketReverseProxy creates a new reverse proxy for proxying websocket connections.
158157func newWebSocketReverseProxy(u *url.URL, skipTLSVerify bool) http.Handler {
159− // This should create the correct scheme for insecure vs secure connections
160− wsScheme := "ws" + strings.TrimPrefix(u.Scheme, "http")
161− wsURL := &url.URL{Scheme: wsScheme, Host: u.Host}
162−
163− wsProxy := wsutil.NewSingleHostReverseProxy(wsURL)
158+ wsProxy := httputil.NewSingleHostReverseProxy(u)
164159 /* #nosec G402 */
165160 if skipTLSVerify {
166− wsProxy.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
161+ wsProxy.Transport = &http.Transport{
162+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
163+ }
167164 }
168165 return wsProxy
169166}