Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Health-check endpoint for AWS Target Groups #251
In AWS API can be deployed as an auto-scaling group behind a load-balancer. The LB runs a regular health-check on the registered instances, which it's just a PING on port 80 (if configured correctly).
However, API can also be deployed as a target group, for example when the LB acts as a listener, terminating HTTPS requests and routing them to a Target Group.
An AWS Target Group has its own health checks, however they consist of HTTP or HTTPS requests only (a path can be customised, but no more than this, i.e. no configurable headers). API always expects an authentication token in the request headers, therefore it returns a 401, and the health checks from the Target Group fail, marking the API instances as unhealthy.
We need a way to configure API so that, in the above deployment scenario, it returns a 200 HTTP status code on a specific request used to monitor its health.
Possibly this could be the Status endpoint?
I think I'll allow requests at the root which will return a "Welcome to DADI API" page, as CDN also does. Web has a friendly first page as well, for first time users - perhaps we could do a similar one for API, with a little detail and information on where to go for help.