Back to services

HAProxy

Very fast and reliable reverse-proxy offering high availability, load balancing, and proxying for TCP and HTTP-based applications.

View alternatives to HAProxy
Suggest edit
Open source
Self-hostable
GPL-2.0
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Note: This entry was written without being able to fetch the official website. The content is based on existing knowledge of HAProxy. For details on specific version features, please refer to the official website and the official documentation.

Introduction

HAProxy (High Availability Proxy) is a free, open-source load balancer and proxy server that supports TCP (layer 4) and HTTP (layer 7) traffic. It was started by Willy Tarreau and is written in C. It is known for its high performance, stability, and low resource usage. Many high-traffic websites and cloud platforms use it, and it is commonly found in the software repositories of Linux distributions.

Key Features

  • Layer 4 and layer 7 load balancing: Distributes TCP connections and HTTP requests across multiple backend servers, with a variety of scheduling algorithms such as round robin, least connections, and source address hashing.
  • Reverse proxy: Sits in front of application servers, receives client requests in one place, and forwards them to different backends according to rules.
  • SSL/TLS termination: Handles HTTPS encryption and decryption at the proxy layer, reducing the load on backends.
  • Health checks: Actively checks the status of backend servers, automatically removes failed nodes, and adds them back once they recover.
  • ACLs and traffic rules: Routes, rewrites, blocks, or rate-limits traffic based on conditions such as request headers, paths, domains, and source IPs.
  • Session persistence: Uses mechanisms such as cookies or stick tables to keep the same client connected to the same backend.
  • Monitoring and statistics: Includes a built-in statistics page and a runtime management interface, making it easy to view real-time status and adjust configuration dynamically.
  • Modern protocol support: Newer versions support modern protocols such as HTTP/2.

Target Users and Use Cases

HAProxy is mainly aimed at operations engineers, SREs, system administrators, and backend architects, and is commonly used for:

  • Front-end load balancing for web applications and API services
  • Building high-availability clusters, often paired with Keepalived for active/standby failover
  • Proxying TCP services such as databases (e.g. MySQL, PostgreSQL) and splitting reads and writes
  • Serving as an ingress gateway and traffic scheduler in microservice or container environments

Core Strengths

  • High performance: Its event-driven architecture lets a single machine handle a large number of concurrent connections with low resource usage.
  • Stability: Proven in large-scale production environments over many years.
  • Flexible configuration: The configuration file is highly expressive and can implement complex traffic control logic.
  • Free and open source: Released under the GPL license, with an active community and thorough documentation.

Installation and Deployment

On most Linux distributions, you can install it directly with the package manager:

# Debian / Ubuntu
sudo apt install haproxy

# RHEL / CentOS / Rocky
sudo dnf install haproxy

You can also run it using the official Docker image:

docker run -d -p 80:80 -v $(pwd)/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy

You can also download the source code from the official website and compile it yourself. The configuration file is usually located at /etc/haproxy/haproxy.cfg and mainly consists of sections such as global, defaults, frontend, and backend.

Technical Requirements

  • Runs mainly on Linux, and also supports Unix-like systems such as FreeBSD
  • Resource requirements are very low; an ordinary server or virtual machine can handle substantial traffic

Notable Points

  • In addition to the community edition, HAProxy Technologies offers a commercial enterprise edition and related products
  • Releases are divided into stable and long-term support (LTS) versions; LTS versions are recommended for production environments
  • Common alternatives or similar tools include Nginx, Envoy, and Traefik