Configuration basics

Healthchecks

On this page

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:

haproxy
healthcheck mycheck
type httpchk
http-check connect alpn h2
http-check send meth HEAD uri /health ver HTTP/2 hdr Host www.example.com
backend webservers
server web1 10.0.0.1:80 check healthcheck mycheck
server web2 10.0.0.2:80 check
server web3 10.0.0.3:80 check
haproxy
healthcheck mycheck
type httpchk
http-check connect alpn h2
http-check send meth HEAD uri /health ver HTTP/2 hdr Host www.example.com
backend webservers
server web1 10.0.0.1:80 check healthcheck mycheck
server web2 10.0.0.2:80 check
server 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.

Do you have any suggestions on how we can improve the content of this page?