kanagaraj palanisamy
kanagaraj palanisamy

Reputation: 397

google http load balancing - returns 401 Unauthorized

I have a HTTP Load Balancer setup as shown below. The content will be routed to backend bucket or an instance group depending on the url.

enter image description here The firewall allows everything on the port 80

enter image description here

When I tried accessing the API using the load balanced IP, I get the error Status Code: 401 Unauthorized.

Here is the Stackdriver logging snapshot of that particular request.

    http://3xxxxxx5/api/GetAccountTransaction?key=AIzaSyC3xxxxxxMHNAxKM
     1xxxxxx06 - "POST http://3xxxxxx5/api/GetAccountTransaction?key=AIzaSyC3xxxxxxMHNAxKM" 401 494 "http://3xxxxxx5/" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
    Expand all | Collapse all {
     httpRequest: {
      referer:  "http://3xxxxxx5/"   
      remoteIp:  "1xxxxxx06"   
      requestMethod:  "POST"   
      requestSize:  "559"   
      requestUrl:  "http://3xxxxxx5/api/GetAccountTransaction?key=AIzaSyC3xxxxxxMHNAxKM"   
      responseSize:  "494"   
      status:  401   
      userAgent:  "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"   
     }
     insertId:  "efo39lf8k5sux"  
     jsonPayload: {
      @type:  "type.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry"   
      statusDetails:  "response_sent_by_backend"   
     }
     logName:  "projects/sixxxxxx4204/logs/requests"  
     receiveTimestamp:  "2018-03-30T12:09:37.539673973Z"  
     resource: {
      labels: {
       backend_service_name:  ""    
       forwarding_rule_name:  "prepay-ip-address"    
       project_id:  "sixxxxxx4204"    
       target_proxy_name:  "prepay-service-target-proxy"    
       u

rl_map_name:  "prepay-service"    
   zone:  "global"    
  }
  type:  "http_load_balancer"   
 }
 severity:  "WARNING"  
 spanId:  "5da2dc551e28dbcc"  
 timestamp:  "2018-03-30T12:09:36.491864533Z"  
 trace:  "projects/sixxxxxx4204/traces/52617f14af59859ee38e759f605bc545"  
}

However, when I use the same request but with the external IP of the VM instance, it works.

What authentication does this error from the load balancer refer to?

Upvotes: 0

Views: 1680

Answers (0)

Related Questions