HAProxy Load Balancer: free, open source, reliable
HAProxy, which stands for High Availability Proxy, is a popular open source software TCP/HTTP Load Balancer and proxying solution.
HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers.
It is a TCP/HTTP reverse proxy which is particularly suited for high availability environments. It features connection persistence through HTTP cookies, load balancing, header addition, modification, deletion both ways. It has request blocking capabilities and provides interface to display server status.
Written in: C
Project Goals
- It offers high availability, load balancing, and proxying for TCP and HTTP-based applications.
- It is particularly suited for very high traffic web sites and powers quite a number of the world's most visited ones.
- To be de-facto standard opensource load balancer, being shipped with most mainstream Linux distributions, and often deployed by default in cloud platforms.
Project Features
- Layer 4 (TCP) and Layer 7 (HTTP) load balancing
- URL rewriting
- Rate limiting
- SSL/TLS termination
- Gzip compression
- Proxy Protocol support
- Health checking
- Connection and HTTP message logging
Project Design and Security
- It offers the building blocks to create a strong, layered defense against DDoS, malicious bot traffic, vulnerability scanners and more.
- HTTP normalizer: when configured to process HTTP traffic, only valid complete requests are passed. This protects against a lot of protocol-based attacks.
- HTTP fixing tool : it can modify / fix / add / remove / rewrite the URL or any request or response header. This helps fixing interoperability issues in complex environments.
- Observation point for network troubleshooting : due to the precision of the information reported in logs, it is often used to narrow down some network-related issues.
Sample Configuration
# Sample Configuration for HAProxy @ /etc/haproxy/haproxy.cfg
global
log 127.0.0.1 local0 debug
maxconn 1024
chroot /var/haproxy
uid 604
gid 604
daemon
pidfile /var/run/haproxy.pid
defaults
log global
mode http
option httplog
option dontlognull
option redispatch
retries 3
maxconn 2000
frontend haproxy
bind *:80
default_backend httpd
backend httpd
option forwardfor
http-request set-header X-Forwarded-For %[src]
balance roundrobin
server www 127.0.0.1:8080 check
server www 127.0.0.1:8081 check
# END