Merge branch 'master' into auth-resolver
This commit is contained in:
		@@ -133,22 +133,19 @@ 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
 | 
			
		||||
	host := req.URL.Hostname()
 | 
			
		||||
	if len(host) == 0 {
 | 
			
		||||
		host = req.Host
 | 
			
		||||
		// fallback to req.Host
 | 
			
		||||
		host, _, _ = net.SplitHostPort(req.Host)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logger.Infof("Host is %v", host)
 | 
			
		||||
 | 
			
		||||
	// check for an ip address
 | 
			
		||||
	if net.ParseIP(host) != nil {
 | 
			
		||||
		return auth.DefaultNamespace, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// split the host to remove the port
 | 
			
		||||
	host, _, err := net.SplitHostPort(req.Host)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// check for dev enviroment
 | 
			
		||||
	if host == "localhost" || host == "127.0.0.1" {
 | 
			
		||||
		return auth.DefaultNamespace, nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user