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

PR #7595 fixed part of the regression, but did not handle the
scenario, where in docker, the internal port is different from
the port on the host.

This PR modifies the regular expression such that all the
scenarios are handled.

Fixes #7619
master
kannappanr 6 years ago committed by Harshavardhana
parent 08b9244c48
commit c422f7f412
  1. 10
      cmd/api-router.go

@ -17,7 +17,6 @@
package cmd
import (
"net"
"net/http"
"github.com/gorilla/mux"
@ -46,13 +45,8 @@ func registerAPIRouter(router *mux.Router, encryptionEnabled bool) {
apiRouter := router.PathPrefix("/").Subrouter()
var routers []*mux.Router
for _, domainName := range globalDomainNames {
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.Host("{bucket:.+}."+domainName).Subrouter())
routers = append(routers, apiRouter.Host("{bucket:.+}."+domainName+":{port:.*}").Subrouter())
}
routers = append(routers, apiRouter.PathPrefix("/{bucket}").Subrouter())

Loading…
Cancel
Save