talira

The Reliable, High Performance TCP/HTTP Load Balancer

open coreGPL-2.0-or-later AND LGPL-2.1-or-laterself-hostablefree

HAProxy is a free, open source load balancer and reverse proxy for TCP and HTTP applications, made for very high-traffic sites and shipped with most mainstream Linux distributions. Its event-driven, multi-threaded engine terminates TLS, switches on any part of a request, health-checks servers, keeps clients on the same server with stick-tables replicated between peers, rate-limits and blocks abusive clients, rewrites HTTP, compresses responses and caches small objects in RAM, with HTTP/2, QUIC/HTTP/3 and ACME certificate management in recent releases. It is changed at runtime through a CLI socket, scripted in Lua, and exposes its statistics to Prometheus through a built-in exporter. The core is GPL-2.0-or-later; HAProxy Technologies, whose CTO Willy Tarreau wrote HAProxy, sells HAProxy Enterprise with a WAF, bot management, a management GUI and support.

Ways to install

Problems it solves

  • spread incoming HTTP requests across a pool of web servers and skip the ones failing health checks
  • load balance raw TCP connections to a database or mail server cluster
  • terminate TLS for thousands of domains with SNI on one load balancer
  • keep each user on the same backend server for their whole session
  • share stickiness and rate counters between two load balancers running active-active
  • track request rates per IP and slow down or block clients abusing my API
  • route requests to different backend pools by path, Host header or cookie
  • serve HTTP, HTTPS and SSH on the same port and route each connection by protocol
  • drain a backend server for maintenance or change its weight without reloading the proxy
  • add or change backend pools at runtime without a reload
  • export load balancer statistics to Prometheus and graph them in Grafana
  • shield fragile backend servers from SYN floods and malformed HTTP requests
  • load balance PHP-FPM application servers over FastCGI without another web server in between
  • get Let's Encrypt certificates directly in the load balancer with ACME
  • add custom routing and authentication logic to my load balancer with scripts

View all 25 problems

Features

  • TCP proxy and HTTP reverse proxy, HTTP/1.x and HTTP/2 on either side with ALPN detection
  • SSL/TLS termination, initiation and offload with SNI, wildcard certificates, client certificates and OCSP stapling
  • certificates updated at runtime without restarting; deployments with tens of thousands of certificates
  • QUIC/HTTP/3, ACME certificate management, OpenTelemetry and TLS ECH in recent releases
  • dynamic backends (3.4 LTS)
  • content-based switching on any element of the request, including several protocols on one port
  • TCP and HTTP load balancing with health checks; weights changed on the fly from the CLI
  • stick-tables for stickiness and per-client statistics, replicated active-active between peers
  • rate limiting, traffic prioritization and DDoS and abuse protection
  • TCP and HTTP normalization that drops invalid packets and requests
View 10 more
  • URL and header rewriting for requests and responses
  • HTTP compression offload and an in-memory response cache
  • FastCGI gateway for load balancing FastCGI application servers
  • PROXY protocol to pass the client address to servers
  • transparent bind and connect, network namespaces (Linux)
  • statistics page and a built-in Prometheus exporter
  • CLI over a UNIX or TCP socket for runtime changes
  • Lua scripting
  • event-driven, multi-threaded engine; shown at 2 million requests/s over SSL and 100 Gbps forwarded
  • long-term support branches maintained for about five years

Limitations

  • Doesn't serve static files: it can't be used as a static web server, so it's put in front of one such as Apache or nginx6
  • Doesn't work as a forward proxy for browsers: it isn't an explicit HTTP proxy like Squid6
  • Doesn't do packet-level load balancing: it doesn't see IP packets or UDP datagrams, and does no NAT or direct server return6

Ways to run it

HAProxy Community

You run it, GPL-2.0-or-later AND LGPL-2.1-or-later

free78

Not included

  • a management GUI, WAF, bot management, global rate limiting and native SSO module, which HAProxy Enterprise adds9
  • premium support from HAProxy Technologies9

Self-hosting docs

HAProxy Enterprise

You run it, under a commercial licence

no price listed: trial, then request pricing79

Only in this edition

  • WAF, bot management, CAPTCHA and JavaScript challenge modules
  • global rate limiting
  • native single sign-on module for Active Directory and SAML identity providers
  • centralized management with HAProxy Fusion, including role-based access control
  • device detection modules and automatic updates of ACL, map and geolocation files
  • premium support
  • Linux packages and cloud images for AWS and Azure

Self-hosting docs

Capabilities

Has an APIplan not known
Has a command line toolplan not known
Takes pluginsplan not known

Alternatives

The same job

These do what HAProxy does.

  1. nginx HTTP web server, reverse proxy, content cache, load balancer, TCP/UDP proxy server, and mail proxy server
  2. Sōzu A lightweight, fast, always-up HTTP reverse proxy built in Rust
  3. Traefik Proxy The Cloud Native Application Proxy
  4. Caddy The Ultimate Server with Automatic HTTPS
  5. Envoy Proxy Envoy is an open source edge and service proxy, designed for cloud-native and AI-native applications
  6. F5 NGINX Ingress Controller A production-grade Ingress Controller for Kubernetes, powered by NGINX or NGINX Plus.

Compare HAProxy with the top 3