Skip to content

Commit

Permalink
Fix: Handle regression caused by gorilla mux v1.7.0 (minio#7625)
Browse files Browse the repository at this point in the history
PR minio#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 minio#7619
  • Loading branch information
kannappanr authored and harshavardhana committed May 7, 2019
1 parent 08b9244 commit c422f7f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions cmd/api-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package cmd

import (
"net"
"net/http"

"github.com/gorilla/mux"
Expand Down Expand Up @@ -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())

Expand Down

0 comments on commit c422f7f

Please sign in to comment.