git.iko.soy/typeable/oauth2-proxy
on master help sign in
Use the httputil.NewSingleHostReverseProxy instead of yhat/wsutil for … (#1348)
3957183Matt Lilley
CHANGELOG.md+1
@@ -18,6 +18,7 @@
18
18
19## Changes since v7.1.3
19## Changes since v7.1.3
20
20
21+- [#1348](https://github.com/oauth2-proxy/oauth2-proxy/pull/1348) Using the native httputil proxy code for websockets rather than yhat/wsutil to properly handle HTTP-level failures (@thetrime)
21- [#1379](https://github.com/oauth2-proxy/oauth2-proxy/pull/1379) Fix the manual sign in with --htpasswd-user-group switch (@janrotter)
22- [#1379](https://github.com/oauth2-proxy/oauth2-proxy/pull/1379) Fix the manual sign in with --htpasswd-user-group switch (@janrotter)
22- [#1337](https://github.com/oauth2-proxy/oauth2-proxy/pull/1337) Changing user field type to text when using htpasswd (@pburgisser)
23- [#1337](https://github.com/oauth2-proxy/oauth2-proxy/pull/1337) Changing user field type to text when using htpasswd (@pburgisser)
23- [#1239](https://github.com/oauth2-proxy/oauth2-proxy/pull/1239) Base GitLab provider implementation on OIDCProvider (@NickMeves)
24- [#1239](https://github.com/oauth2-proxy/oauth2-proxy/pull/1239) Base GitLab provider implementation on OIDCProvider (@NickMeves)
go.mod−1
@@ -29,7 +29,6 @@ require (
29 github.com/spf13/viper v1.6.3
29 github.com/spf13/viper v1.6.3
30 github.com/stretchr/testify v1.6.1
30 github.com/stretchr/testify v1.6.1
31 github.com/vmihailenco/msgpack/v4 v4.3.11
31 github.com/vmihailenco/msgpack/v4 v4.3.11
32− github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997
33 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
32 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
34 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
33 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
35 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
34 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
go.sum−2
@@ -426,8 +426,6 @@ github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37w
426github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
426github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
427github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
427github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
428github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
428github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
429−github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997 h1:1+FQ4Ns+UZtUiQ4lP0sTCyKSQ0EXoiwAdHZB0Pd5t9Q=
430−github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997/go.mod h1:DIGbh/f5XMAessMV/uaIik81gkDVjUeQ9ApdaU7wRKE=
431github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
429github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
432github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
430github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
433github.com/yuin/gopher-lua v0.0.0-20191213034115-f46add6fdb5c/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
431github.com/yuin/gopher-lua v0.0.0-20191213034115-f46add6fdb5c/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
pkg/upstream/http.go+4−7
@@ -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"
14)
13)
15
14
16const (
15const (
@@ -156,14 +155,12 @@ func setProxyDirector(proxy *httputil.ReverseProxy) {
156
155
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}
162−
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},
163+ }
167 }
164 }
168 return wsProxy
165 return wsProxy
169}
166}