From f7f9517b6ae297210aca2a68416e298396c07076 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 23 Sep 2020 12:10:09 -0700 Subject: [PATCH] fix: host extraction without port --- cmd/api-router.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/api-router.go b/cmd/api-router.go index d8dcd36e6..9f329f40a 100644 --- a/cmd/api-router.go +++ b/cmd/api-router.go @@ -88,7 +88,10 @@ func registerAPIRouter(router *mux.Router) { for _, domainName := range globalDomainNames { if IsKubernetes() { routers = append(routers, apiRouter.MatcherFunc(func(r *http.Request, match *mux.RouteMatch) bool { - host, _, _ := net.SplitHostPort(getHost(r)) + host, _, err := net.SplitHostPort(getHost(r)) + if err != nil { + host = r.Host + } // Make sure to skip matching minio.` this is // specifically meant for operator/k8s deployment // The reason we need to skip this is for a special