mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
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.
This commit is contained in:
parent
091b9b661f
commit
781012517d
@ -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…
Reference in New Issue
Block a user