Skip to content

How to Configure HAProxy HTTP Health Checks

DodaTech Updated 2026-06-24 1 min read

HTTP health checks provide more accurate server monitoring than TCP checks by validating application responses. This guide walks through the specific troubleshooting steps to diagnose and resolve HTTP health check issues.

Before You Begin

Before you begin, be sure to have the following in place:

  • A Linux server with the relevant software installed
  • Access to the command line interface
  • Appropriate permissions (root or sudo)

Quick Fix

Wrong

option httpchk (defaults to OPTIONS /)

Wrong: Default OPTIONS health check on root path

option httpchk GET /healthz HTTP/1.1\nhttp-check expect status 200

Right: GET /healthz expecting status 200

Output

Health check configured:\n  Method: GET /healthz\n  Expected: status 200\n  Protocol: HTTP/1.1

Prevention

To avoid future issues, follow these best practices:

  • Use a dedicated health check endpoint on backend servers
  • Validate expected status code with http-check expect
  • Use HTTP/1.1 with Host header for virtual hosting
  • Set check inter 5s for quick failure detection
  • Use http-check send for custom request headers

DodaTech Tools

For further assistance with any of the above issues, consider using DodaTech consulting services or DodaTech tutorials for more in-depth guidance.

Common Mistakes with http check

  1. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  2. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  3. Using head and tail instead of pattern matching, causing runtime errors on empty lists

These mistakes appear frequently in real-world HAPROXY code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

Why should I use a dedicated health check endpoint?|||A minimal /healthz endpoint avoids heavy application logic. Root / endpoint may return 404 or trigger full page rendering.
What does http-check expect do? It validates the response from the health check. You can check status codes, response body strings, or even binary flags.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro