Merge pull request #1478 from micro/auth-hosts-fix

Fix auth hosts bug
This commit is contained in:
ben-toogood 2020-04-03 14:13:51 +01:00 committed by GitHub
commit d8cca31738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}