A health check is a scheduled HTTP or TCP request that you can configure to run on a repeating basis to ensure that a service is healthy.
For example, you can configure an HTTP health check to ping the root URL of your site and ensure that the response is HTTP 200 (OK). In the cloud control panel, you can only define the HTTP path that you would like to have checked.
Health checks ensure that your app is communicating with “healthy” containers in App Platform. The load balancer for App Platform only direct traffic to containers that passed the health checks. If the container fails the health checks, App Platform’s load balancer will remove the container from rotation until the container passes the health checks.
If you want to learn more about the error codes associated with health checks, see App Platform Error Code Reference.
DigitalOcean Load Balancers only use Droplets that pass health checks. The load balancer automatically removes Droplets that fail health checks from rotation and adds them back when their health checks pass.
You are able to configure how the load balancer interacts with health checks, such as its check interval, response timeout, and unhealthy threshold. For example, you can specify how many seconds the load balancer will wait between health checks.
To configure the load balancer to balance TCP, you need to add a TCP-forwarding rule and a TCP health check. The success criteria for HTTP and HTTPS health checks is a status code response in the range of 200 to 399. The success criteria for TCP health checks is completing a TCP handshake to connect.
HTTP health checks use HTTP/1.1. If your web server uses a version other than HTTP/1.1, the headers in the health check may not be compatible and you’ll need to use a TCP check instead.