What Is New in HAProxy 1.2
HAProxy 1.2 delivers a foundational set of features that established its core load balancing capabilities. This release introduced critical protocol support and server management features that are still relevant today.
| Category | Key Changes |
|---|---|
| New Features | SSL support, URI hashing, backup servers, agent checks, HTTP keep-alive |
| Improvements | Enhanced logging, new ACLs, better cookie handling, more stats options |
| Bug Fixes | Connection establishment, header parsing, stats page fixes |
How did SSL support change in HAProxy 1.2?
This was the first version to introduce native SSL termination. You could finally offload SSL processing from your backend servers directly onto the load balancer.
The implementation used the OpenSSL library, allowing HAProxy to handle HTTPS traffic and then forward decrypted HTTP to the backends. This was a massive win for reducing backend CPU load and simplifying certificate management in one central place.
What new load balancing algorithms were added?
URI hashing (balance uri) arrived in this release. This algorithm hashes the URI to always send the
same request to the same server, which is perfect for caching scenarios.
It provided a much-needed sticky session alternative to using cookies. You could now ensure user sessions hit the same backend without needing to inject or rely on cookie headers from the application.
How did server management get better?
The concept of backup servers was introduced. You could mark servers as backup so they would only be
used when all other primary servers were down.
Agent checks were also added, allowing a separate, lighter-weight health check to determine a server's status. This let you use a simple TCP check for quick failover while running a more thorough HTTP check less frequently.
What logging improvements were made?
Logging got significantly more detailed. You could now capture the backend name, server name, connection timers, and even the number of retries a request experienced.
This level of detail was crucial for debugging complex routing issues and understanding exactly where time was being spent during a request's journey through the proxy.
Were there any important ACL additions?
Yes, several key ACLs were added that expanded the criteria for routing decisions. New ACLs included
hdr_cnt to count headers and cookie to inspect cookie values.
This allowed for much more sophisticated content switching rules. You could now route traffic based on the presence or absence of specific cookies, not just IP addresses or paths.
FAQ
Does HAProxy 1.2 support TLS 1.3?
No, TLS 1.3 was created much later. This initial SSL
implementation in 1.2 only supports older SSL protocols and early versions of TLS, which are now considered
insecure and deprecated.
Can I use the 'balance uri' algorithm for session persistence?
Yes, but with a caveat. It's
excellent for caching as the same URI always hits the same server. However, if a user's session involves
multiple URIs, they might be directed to different backends, breaking statefulness.
What's the difference between a health check and an agent check?
A regular health check
(e.g., HTTP) validates if the application is functioning. An agent check is a simpler, often TCP-based check
used for faster failure detection and operational control, like manually taking a server offline via the agent
port.
How do I specify a backup server in the configuration?
You add the backup
keyword to a server line in your backend configuration. For example:
server node4 10.0.0.4:80 backup. This server will only receive traffic if all non-backup servers
are unavailable.
Is HTTP Keep-Alive the same as TCP connection pooling?
They are related but distinct.
Enabling HTTP Keep-Alive on the client side allows a single TCP connection to handle multiple HTTP requests. The
changes in 1.2 improved how HAProxy manages these persistent connections between itself and the clients,
reducing TCP overhead.