From c422f7f41267dab23973093a30fae3ee7864f404 Mon Sep 17 00:00:00 2001 From: kannappanr <30541348+kannappanr@users.noreply.github.com> Date: Tue, 7 May 2019 10:36:00 -0700 Subject: [PATCH] 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 --- cmd/api-router.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/api-router.go b/cmd/api-router.go index 59e05909e..0d74276e1 100644 --- a/cmd/api-router.go +++ b/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())