Skip to content

Commit b753597

Browse files
Fixed When the MINIO_BROWSER_REDIRECT_URL parameter contains path, the console cannot be accessed normally.
1 parent 15634e5 commit b753597

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

restapi/configure_console.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ func FileServerMiddleware(next http.Handler) http.Handler {
320320
w.Header().Set("Server", globalAppName) // do not add version information
321321
basePath := GetSubPath()
322322
switch {
323-
case strings.HasPrefix(r.URL.Path, basePath+"/ws"):
323+
case strings.HasPrefix(r.URL.Path, basePath+"ws"):
324324
serveWS(w, r)
325-
case strings.HasPrefix(r.URL.Path, basePath+"/api"):
325+
case strings.HasPrefix(r.URL.Path, basePath+"api"):
326326
next.ServeHTTP(w, r)
327327
default:
328328
buildFs, err := fs.Sub(portal_ui.GetStaticAssets(), "build")
@@ -360,7 +360,7 @@ func handleSPA(w http.ResponseWriter, r *http.Request) {
360360
if v := r.URL.Query().Get("cp"); v == "y" {
361361
if base := r.URL.Query().Get("cpb"); base != "" {
362362
// make sure the subpath has a trailing slash
363-
if !strings.HasSuffix(base, basePath) {
363+
if !strings.HasSuffix(base, "/") {
364364
base = fmt.Sprintf("%s/", base)
365365
}
366366
basePath = base
@@ -441,7 +441,7 @@ func handleSPA(w http.ResponseWriter, r *http.Request) {
441441
// wrapHandlerSinglePageApplication handles a http.FileServer returning a 404 and overrides it with index.html
442442
func wrapHandlerSinglePageApplication(h http.Handler) http.HandlerFunc {
443443
return func(w http.ResponseWriter, r *http.Request) {
444-
if r.URL.Path == GetSubPath()+"/" {
444+
if match, _ := regexp.MatchString(fmt.Sprintf("^%s/?$", GetSubPath()), r.URL.Path); match {
445445
handleSPA(w, r)
446446
return
447447
}
@@ -501,7 +501,7 @@ func replaceBaseInIndex(indexPageBytes []byte, basePath string) []byte {
501501
return indexPageBytes
502502
}
503503
indexPageStr := string(indexPageBytes)
504-
newBase := fmt.Sprintf("<base href=\"%s/\"/>", basePath)
504+
newBase := fmt.Sprintf("<base href=\"%s\"/>", basePath)
505505
indexPageStr = strings.Replace(indexPageStr, "<base href=\"/\"/>", newBase, 1)
506506
indexPageBytes = []byte(indexPageStr)
507507

restapi/ws_handle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var upgrader = websocket.Upgrader{
4343

4444
const (
4545
// websocket base path
46-
wsBasePath = "/ws"
46+
wsBasePath = "ws"
4747
)
4848

4949
// ConsoleWebsocketAdmin interface of a Websocket Client

0 commit comments

Comments
 (0)