Fix: Handle regression caused by gorilla mux v1.7.0 (#7595)

gorilla/mux#383 broke the compatibility with the existing code.
This PR handles that scenario.
master
kannappanr 6 years ago committed by Nitish Tiwari
parent 091b9b661f
commit 781012517d
  1. 9
      cmd/api-router.go

@ -17,6 +17,7 @@
package cmd
import (
"net"
"net/http"
"github.com/gorilla/mux"
@ -45,7 +46,13 @@ func registerAPIRouter(router *mux.Router, encryptionEnabled bool) {
apiRouter := router.PathPrefix("/").Subrouter()
var routers []*mux.Router
for _, domainName := range globalDomainNames {
routers = append(routers, apiRouter.Host("{bucket:.+}."+domainName).Subrouter())
var hostPort string
if globalMinioPort != "443" && globalMinioPort != "80" {
hostPort = net.JoinHostPort(domainName, globalMinioPort)
} else {
hostPort = domainName
}
routers = append(routers, apiRouter.Host("{bucket:.+}."+hostPort).Subrouter())
}
routers = append(routers, apiRouter.PathPrefix("/{bucket}").Subrouter())

Loading…
Cancel
Save