HAProxy Fundamentals
HAProxy is a proxy and load balancer that accepts network traffic, applies routing rules, and sends each connection or HTTP request to an available backend server.
itWeb servers, proxies, and traffic management | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Intro
HAProxy Fundamentals
HAProxy sits between clients and application servers. A client connects to HAProxy. HAProxy accepts that connection, applies the configured policy, and opens or uses a connection to a backend server.
This position gives HAProxy one clear job: control traffic before it reaches your application fleet. You can distribute work, route requests by HTTP information, terminate TLS, check server health, and keep unavailable servers out of rotation.
The mental model
Treat the configuration as a traffic path.
- A
frontendowns one or more listening sockets throughbind. - The frontend selects a
backend, either as its default or through a conditional rule. - The backend contains named
serverentries and a balancing policy. - HAProxy selects an eligible server and proxies the traffic.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.haproxy.com/documentation/haproxy-configuration-tutorials/proxying-essentials/configuration-basics/
Supports
- HAProxy configuration uses global, defaults, frontend, backend, listen, and program sections
- Defaults provide inherited settings for later proxy sections
- A listen section combines frontend and backend roles
- https://www.haproxy.com/documentation/haproxy-configuration-tutorials/proxying-essentials/configuration-basics/frontends/
Supports
- A frontend defines client-facing addresses and ports
- Frontends can use HTTP or TCP mode
- Frontends use default_backend and ACL-based use_backend rules to choose backends
- A frontend mode should match the backend mode it sends traffic to
- https://www.haproxy.com/documentation/haproxy-configuration-tutorials/proxying-essentials/configuration-basics/backends/
Supports
- Backends contain servers that receive proxied traffic
- The balance directive selects a server selection algorithm
- Round robin suits similar-capacity servers with short requests
- Least connections suits long-lived connections
- HAProxy 3.3 and later defaults to random selection, while 3.2 and earlier defaults to round robin
- The check argument enables health checking for a server
- https://www.haproxy.com/documentation/haproxy-configuration-tutorials/reliability/health-checks/
Supports
- Active checks connect to a server or send an HTTP request at regular intervals
- Consecutive failed checks can remove a server from rotation
- Consecutive successful checks can restore a server to rotation
- HTTP checks can evaluate response status or content
- https://www.haproxy.com/documentation/haproxy-configuration-tutorials/security/ssl-tls/basics-enable-tls/
Supports
- HAProxy can encrypt client-side and server-side connections with TLS
- A bind line can enable client-side TLS with ssl and crt arguments
- Verify required validates a backend certificate against a configured CA file
- HTTP redirects and HSTS have different effects and HSTS should be tested with a low max-age value
- https://www.haproxy.com/documentation/haproxy-configuration-tutorials/protocol-support/tcp/
Supports
- HAProxy can operate as a TCP proxy that relays streams to backend server pools
- https://docs.haproxy.org/3.2/configuration.html
Supports
- The configuration manual provides directive syntax and scope for HAProxy 3.2
