Skip to content

Commit

Permalink
Fix Hop Websockets (#1609)
Browse files Browse the repository at this point in the history
* Fix Hop Websockets

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
  • Loading branch information
dvaldivia authored May 23, 2023
1 parent 27c254a commit e3e8878
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 7 additions & 5 deletions api/configure_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions api/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package api
import (
"bytes"
"crypto/sha1"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e3e8878

Please sign in to comment.