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

孤人 提交于 2021-02-07 10:24:53

问题


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?

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/33891705/http-load-balancing-with-health-checks-requiring-basic-auth-in-google-cloud-plat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!