Configuration basics
Healthchecks
This page applies to:
- HAProxy 3.4 and newer
The healthcheck section defines reusable health check directives to reduce configuration duplication and override the local proxy configuration. Assign health check settings to individual servers within the same backend, and define multiple healthcheck sections with different health check settings that can be applied to individual backend servers. The healthcheck section supports all available health check types and all http-check and tcp-check directives.
Directives declared in a healthcheck section are applied to backend servers with the healthcheck argument on server configuration lines. For example, the HTTP health checks defined in mycheck are only applied to the web1 server:
haproxyhealthcheck mychecktype httpchkhttp-check connect alpn h2http-check send meth HEAD uri /health ver HTTP/2 hdr Host www.example.combackend webserversserver web1 10.0.0.1:80 check healthcheck mycheckserver web2 10.0.0.2:80 checkserver web3 10.0.0.3:80 check
haproxyhealthcheck mychecktype httpchkhttp-check connect alpn h2http-check send meth HEAD uri /health ver HTTP/2 hdr Host www.example.combackend webserversserver web1 10.0.0.1:80 check healthcheck mycheckserver web2 10.0.0.2:80 checkserver web3 10.0.0.3:80 check
See also Jump to heading
See Health checks for examples on how to implement different health check use cases.