Search code examples
amazon-web-servicesload-balancing

Configure AWS load balancer to skip health check or work with non-200 responses


I have a site I am trying to attach to a load balancer that requires Basic Authentication. It fails the health check. I'm guessing this is because instead of returning a 200 it's returning a 401.

Similarly, I have another site that is trying to do a redirect. So instead of returning a 200 it's returning a 302. And again, this is treated as a failure by the health check. (Why do I want to have a load balancer in front of something that just redirects? Because of goofy client requirements, that's why!)

I don't see any way to just disable the health check, or to tell the health checker to accept a response other than a 200, or to tell it to supply authentication credentials, or ... any way around either of these problems.


Solution

  • Two alternatives:

    • Configure a specific url for the health check, one that only sends non-200 responses when the service is really having problems (e.b. no database connection).

    • Change the Ping Protocol to TCP in the ELB configuration. That way it will only check for a sucessful tcp connection and not perform an http request.