Fix auth hosts bug

This commit is contained in:
Ben Toogood 2020-04-03 14:09:25 +01:00
parent 41b746e435
commit b864b3e350

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
}