From e3e8878ac0b04ced387712d712cc6b389b7d876f Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Tue, 23 May 2023 14:27:31 -0700 Subject: [PATCH] Fix Hop Websockets (#1609) * Fix Hop Websockets Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- api/configure_operator.go | 12 +++++++----- api/proxy.go | 4 ++++ cmd/operator/ui.go | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/api/configure_operator.go b/api/configure_operator.go index 1f047711c5b..774cea51cd6 100644 --- a/api/configure_operator.go +++ b/api/configure_operator.go @@ -32,13 +32,14 @@ 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" "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 +151,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 +189,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()