Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hop Websockets #1609

Merged
merged 2 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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