HAProxy Health Checks Guide

February 13, 2026 | HAProxy Health Checks HA

HTTP, TCP, and agent health check types.

HAProxy Health Checks: Beyond Basic Pings

Health checks determine whether HAProxy sends traffic to a backend server. Getting them right is the difference between seamless failover and serving errors to users during incidents.

Health Check Types

TypeHow It WorksBest For
TCPConnects to the portBasic "is the process running?" check
HTTPSends an HTTP request, checks response codeApplication-level health verification
AgentExternal agent reports health statusComplex health logic, gradual drain

HTTP Health Checks

backend web_servers
    option httpchk GET /health HTTP/1.1\r\nHost:\ example.com
    http-check expect status 200
    
    # Check every 5 seconds, mark down after 3 failures, up after 2 successes
    server web1 10.0.1.10:8080 check inter 5s fall 3 rise 2
    server web2 10.0.1.11:8080 check inter 5s fall 3 rise 2

Advanced: Content-Based Health Checks

# Check that the response body contains "healthy"
http-check expect rstring healthy

# Check that response includes database connectivity
http-check expect string "db_connected":true

Agent Health Checks

An agent check connects to a separate port on the backend server. The agent responds with a weight (0-100%) or status (up/down/drain). This enables graceful draining during deployments:

server web1 10.0.1.10:8080 check agent-check agent-port 9999 agent-inter 3s

Designing Good Health Endpoints

Your /health endpoint should check:

  • Application process is running (always true if endpoint responds)
  • Database connectivity (can execute a simple query)
  • Critical dependency availability (cache, message queue)
  • Disk space is sufficient

Important: Don't make health checks too strict. If a non-critical dependency is down, the server may still be able to serve most requests. Use separate /ready and /live endpoints for different check levels.

Eazy SaaS Tip: Use HTTP health checks that verify your application's critical path. A TCP check only confirms the port is open — the application could be in a crash loop returning 500 errors and HAProxy wouldn't know.