Default to Hostname

This commit is contained in:
Ben Toogood 2020-04-07 11:23:21 +01:00
parent cb96949551
commit 76f6f80318

View File

@ -140,7 +140,7 @@ func (h authHandler) NamespaceFromRequest(req *http.Request) string {
} }
// determine the host, e.g. dev.micro.mu:8080 // determine the host, e.g. dev.micro.mu:8080
var host string host := req.URL.Hostname()
if h, _, err := net.SplitHostPort(req.Host); err == nil { if h, _, err := net.SplitHostPort(req.Host); err == nil {
host = h // host does contain a port host = h // host does contain a port
} else if strings.Contains(err.Error(), "missing port in address") { } else if strings.Contains(err.Error(), "missing port in address") {