From b864b3e350b7a76818447f549f98ddc3702171b7 Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Fri, 3 Apr 2020 14:09:25 +0100 Subject: [PATCH] Fix auth hosts bug --- api/server/auth/auth.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/server/auth/auth.go b/api/server/auth/auth.go index 615392a8..186e71c7 100644 --- a/api/server/auth/auth.go +++ b/api/server/auth/auth.go @@ -101,8 +101,14 @@ func (h authHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } func namespaceFromRequest(req *http.Request) (string, error) { + // determine the host, e.g. dev.micro.mu:8080 + host := req.URL.Host + if len(host) == 0 { + host = req.Host + } + // check for an ip address - if net.ParseIP(req.Host) != nil { + if net.ParseIP(host) != nil { return auth.DefaultNamespace, nil }