Johan
Johan

Reputation: 40520

HTTP Load Balancing with health checks requiring basic auth in Google Cloud Platform?

I've created an HTTP Load Balancer (in Google Cloud Platform) but the health check returns a status of unhealthy. My conclusion is that the health check points to a resource that is protected by basic auth and thus the service returns 401 instead of 200. So my questions are:

  1. Is it possible to somehow add basic auth credentials to the health check request?
  2. Is there a workaround?

Upvotes: 1

Views: 3284

Answers (2)

kyleferg
kyleferg

Reputation: 53

Health checks in Google Cloud cannot be provided basic auth credentials to my knowledge. You are correct, in that they expect the status code to be 200 so any endpoint requiring basic auth would fail the health check.

The solution we came up with to resolve this was to have 2 endpoints. One endpoint returns useful status information that we can pull up and look into (which we want behind authorization). We then created a ping endpoint, that uses the same checks as before, only it doesn't display any status information. Just a simple pass/fail message. We leave this endpoint exposed and point the health checks there.

Upvotes: 3

amb
amb

Reputation: 130

HTTP Healthcheck does not use basic auth credentials. This looks like some other issue. 1. Can you ssh into your instance successfully? 2. Does the app can actually answer path you provided as part of health check config ?

See more details in https://cloud.google.com/compute/docs/load-balancing/health-checks

Upvotes: -3

Related Questions