@@ -10,7 +10,6 @@ import (
10 "github.com/mbland/hmacauth"
10 "github.com/mbland/hmacauth"
11 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
11 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
12 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
12 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
13− "github.com/yhat/wsutil"
@@ -156,14 +155,12 @@ func setProxyDirector(proxy *httputil.ReverseProxy) {
157// newWebSocketReverseProxy creates a new reverse proxy for proxying websocket connections.
156// newWebSocketReverseProxy creates a new reverse proxy for proxying websocket connections.
158func newWebSocketReverseProxy(u *url.URL, skipTLSVerify bool) http.Handler {
157func 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}
163− wsProxy := wsutil.NewSingleHostReverseProxy(wsURL)
158+ wsProxy := httputil.NewSingleHostReverseProxy(u)
164 /* #nosec G402 */
159 /* #nosec G402 */
165 if skipTLSVerify {
160 if skipTLSVerify {
161+ wsProxy.Transport = &http.Transport{
166− wsProxy.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
162+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
168 return wsProxy
165 return wsProxy