Skip to content

How to Fix HAProxy Backend Server Down Error

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix HAProxy Backend Server Down Error. We cover key concepts, practical examples, and best practices.

HAProxy shows backend_name/server_name DOWN in the stats page and requests return 503 Service Unavailable — the backend server is failing health checks or is unreachable.

The Problem

$ echo "show stat" | socat /var/run/haproxy.sock stdio | grep DOWN
backend,server_name,0,0,0,0,,0,0,0,0,DOWN,...

Step-by-Step Fix

Step 1: Check health check settings

backend backend_servers
  option httpchk GET /health
  http-check expect status 200
  default-server inter 5s fall 3 rise 2
  server web1 10.0.0.1:80 check
  server web2 10.0.0.2:80 check

Step 2: Verify server connectivity

curl -I http://10.0.0.1:80/health

Step 3: Enable a server manually

echo "enable server backend_servers/web1" | socat /var/run/haproxy.sock stdio

Step 4: Put a server in maintenance

echo "disable server backend_servers/web2" | socat /var/run/haproxy.sock stdio

Step 5: Check HAProxy logs

tail -f /var/log/haproxy.log

Step 6: Adjust check interval for slow servers

server web3 10.0.0.3:80 check inter 10s fall 5 rise 3

Prevention Tips

  • Set realistic health check intervals (5-10s for most services)
  • Use fall 3 minimum to avoid flapping
  • Configure backup servers for redundancy
  • Add option allbackups to use all backup servers when all primaries are down

Common Mistakes with backend down

  1. Using return to exit a function early instead of wrapping a pure value in the monad
  2. Mixing let bindings with <- bindings in do notation, producing type errors
  3. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors

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 does HAProxy mark a server as DOWN when it is actually running?

The health check might be too strict or the timeout too short. Check that the server responds within the configured timeout. Use option httpchk GET /health and http-check expect status 200 to match the server's actual health endpoint.

How do I prevent HAProxy from marking a server DOWN during high load?

Increase the fall count from 3 to 5 or more: server web1 10.0.0.1:80 check fall 5. This allows more consecutive failures before marking the server down, preventing flapping during load spikes.

Can HAProxy automatically re-enable a down server?

Yes, HAProxy automatically retries health checks on down servers based on the inter interval. Once the server passes the configured rise count of checks, it is marked UP again.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro