From d26f0d715a834dbfb8b6319b5befdb47fe7ed50a Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Thu, 18 May 2023 10:02:36 -0700 Subject: [PATCH 1/2] Fix Hop Websockets Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- api/configure_operator.go | 11 ++++++----- api/proxy.go | 4 ++++ cmd/operator/ui.go | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/api/configure_operator.go b/api/configure_operator.go index 1f047711c5b..b0d243eedda 100644 --- a/api/configure_operator.go +++ b/api/configure_operator.go @@ -22,6 +22,7 @@ import ( "context" "crypto/tls" "fmt" + "github.com/klauspost/compress/gzhttp" "io" "io/fs" "net/http" @@ -38,7 +39,6 @@ import ( "github.com/minio/pkg/env" "github.com/minio/pkg/mimedb" - "github.com/klauspost/compress/gzhttp" "github.com/unrolled/secure" "github.com/minio/operator/pkg/auth" @@ -150,10 +150,11 @@ func proxyMiddleware(next http.Handler) http.Handler { // The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document. // So this is a good place to plug in a panic handling middleware, logging and metrics. func setupGlobalMiddleware(handler http.Handler) http.Handler { - // proxy requests - next := proxyMiddleware(handler) + gnext := gzhttp.GzipHandler(handler) // if audit-log is enabled console will log all incoming request - next = AuditLogMiddleware(next) + next := AuditLogMiddleware(gnext) + // proxy requests + next = proxyMiddleware(next) // serve static files next = FileServerMiddleware(next) // add information to request context @@ -187,7 +188,7 @@ func setupGlobalMiddleware(handler http.Handler) http.Handler { } secureMiddleware := secure.New(secureOptions) next = secureMiddleware.Handler(next) - return gzhttp.GzipHandler(next) + return next } // ContextMiddleware attachs request info to context diff --git a/api/proxy.go b/api/proxy.go index 9444063ff80..95e6d3adace 100644 --- a/api/proxy.go +++ b/api/proxy.go @@ -19,6 +19,7 @@ package api import ( "bytes" "crypto/sha1" + "crypto/tls" "encoding/json" "errors" "fmt" @@ -276,6 +277,9 @@ func handleWSRequest(responseWriter http.ResponseWriter, req *http.Request, prox Proxy: http.ProxyFromEnvironment, HandshakeTimeout: 45 * time.Second, Jar: proxyCookieJar, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, } upgrader.CheckOrigin = func(r *http.Request) bool { diff --git a/cmd/operator/ui.go b/cmd/operator/ui.go index 35252154ba8..8a8143141e7 100644 --- a/cmd/operator/ui.go +++ b/cmd/operator/ui.go @@ -108,7 +108,7 @@ func buildOperatorServer() (*api.Server, error) { server := api.NewServer(operatorapi) parser := flags.NewParser(server, flags.Default) - parser.ShortDescription = "MinIO Console Server" + parser.ShortDescription = "MinIO Operator Server" parser.LongDescription = swaggerSpec.Spec().Info.Description server.ConfigureFlags() From 2cf6cfad07c39a4c2749cdf6555c40582b795cbb Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Thu, 18 May 2023 19:45:21 -0700 Subject: [PATCH 2/2] lint Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- api/configure_operator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/configure_operator.go b/api/configure_operator.go index b0d243eedda..774cea51cd6 100644 --- a/api/configure_operator.go +++ b/api/configure_operator.go @@ -22,7 +22,6 @@ import ( "context" "crypto/tls" "fmt" - "github.com/klauspost/compress/gzhttp" "io" "io/fs" "net/http" @@ -33,6 +32,8 @@ import ( "sync" "time" + "github.com/klauspost/compress/gzhttp" + "github.com/minio/operator/pkg/logger" "github.com/minio/operator/pkg/utils" webApp "github.com/minio/operator/web-app"