HAProxy is a open source, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing.

learn more… | top users | synonyms

33
votes
5answers
34k views

How can I remove balanced node from haproxy via command line?

I have haproxy running as my load-balancer and from the stats web interface that comes with haproxy, I can put a web server into maintenance mode (and bring it back out again) - which is great! ...
32
votes
5answers
17k views

Ordering: 1. nginx 2. varnish 3. haproxy 4. webserver?

I've seen people recommend combining all of these in a flow, but they seem to have lots of overlapping features so I'd like to dig in to why you might want to pass through 3 different programs before ...
25
votes
2answers
65k views

How to set up stats for HAProxy?

I can't figure out how to set up stats for HAProxy. This is my configuration: global log 127.0.0.1 local0 log 127.0.0.1 local1 notice daemon #debug user haproxy group haproxy ...
23
votes
4answers
16k views

HAProxy graceful reload with zero packet loss

I'm running an HAProxy load balancing server to balance load to multiple Apache servers. I need to reload HAProxy at any given time in order to change the load balancing algorithm. This all works ...
22
votes
3answers
10k views

How can I deploy a scalable, reliable haproxy cluster on Amazon EC2?

We need some more advanced functionality than ELB provides (mostly L7 inspection), but it's not obvious how to handle things like heartbeat and high availability with something like haproxy using EC2. ...
19
votes
5answers
26k views

How to keep haproxy log messages out of /var/log/syslog

I set up haproxy logging via rsyslogd using the tips from this article, and everything seems to be working fine. The log files get the log messages. However, every log message from haproxy also shows ...
18
votes
6answers
46k views

How can I use HAproxy with SSL and get X-Forwarded-For headers AND tell PHP that SSL is in use?

I have the following setup: (internet) ---> [ pfSense Box ] /-> [ Apache / PHP server ] [running HAproxy] --+--> [ Apache / PHP server ] ...
18
votes
8answers
32k views

Remote IP's with HAProxy

I'm testing a new web server setup which is having a couple of issues. Essentially, we have a web server, where the code uses the remote IP for some interesting things, and also some apache ...
17
votes
2answers
13k views

Do HTTP reverse proxies typically enable HTTP Keep-Alive on the client side of the proxied connection and not on the server side?

HAProxy has the ability to enable HTTP keep-alive on the client side (client <-> HAProxy) but disable it on the server side (HAProxy <-> server). Some of our clients connect to our web service ...
16
votes
3answers
22k views

When using TCP load balancing with HAProxy, does all outbound traffic flow through the LB?

I am setting up an app to be hosted using VMs(probably amazon, but that is not set in stone) which will require both HTTP load balancing and load balancing a large number(50k or so if possible) of ...
16
votes
5answers
11k views

Installing HAProxy on CentOS 6.3?

This is a weird one. I've installed the EPEL for CentOS 6 via # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm The tried to install HAProxy: # yum update # yum ...
16
votes
3answers
22k views

Possible to add basic HTTP access authentication via HAProxy?

I've successfully setup HAProxy in front of an HTTP server which I have no control over. Is it possible to configure HAProxy to add Simple HTTP Authentication to all sites, bearing in mind I can't ...
16
votes
2answers
14k views

LVS vs HAProxy, which should I choose?

I am looking for a solution to load balancing and failover strategy, mainly for big web applications. We have many services to be balanced, such as web, MySQL, and many other HTTP or TCP based ...
16
votes
2answers
13k views

How to Read the haproxy Stats Page

For those of you using HAProxy along with the stats papge (haproxy?stats), how do I interpret this page? There is no decent explanation. For instance: Which Session column displays the number of ...
15
votes
2answers
3k views

By what criteria do you tune timeouts in HA Proxy config?

When configuring HA Proxy, how do you decide what values to assign to the timeouts? I've read a half dozen samples in various blogs, and everyone uses different timeouts and no one discusses why. ...
13
votes
6answers
19k views

Windows replacement for HAProxy

It does not appear that there is a similar question to this already posted, so I will go ahead and ask. I am working on a project that could benefit from having two - four servers handling incoming ...
13
votes
2answers
21k views

How to divert traffic based on hostname using HAProxy?

I've had some initial success with HAProxy setting up a bunch of app servers listening on various other ports. I now have another webserver listening on one port, and i'd like to what changes to make ...
12
votes
2answers
4k views

Is there a way to add more backend server to haproxy without restarting haproxy?

We want to be able to add more backend servers on demand. Right now I don't see a way to add more backend servers to the config file without restarting haproxy.
12
votes
1answer
766 views

haproxy: retain existing sessions under high load, serve '503' to new arrivals

Trying to do what it says in the title: retain existing sessions under high load, and serve 503-message to newly arrived visitors. Problem: it works, but the sessions don't last beyond about 90 ...
11
votes
3answers
13k views

What are the Differences between HAProxy and Ngnix in reverse proxy mode?

What are the differences between HAProxy and Nginx when it comes to their abilities as a reverse proxy?
11
votes
3answers
16k views

How to setup HAProxy with failover?

I understand that, to get failover on an HAProxy load balancing setup, you need two machines running HAproxy (and route it to several webserver instances). But in this case, say abcd.com, how do we ...
11
votes
3answers
15k views

HOWTO use haproxy custom 503 error document when back server sends 503 http code

I would like haproxy to use its own 503 document page when back server (backend) sends HTTP 503 code. Is it possible? Have seen something like "monitor fail" conditions but don't know how to add it ...
11
votes
6answers
7k views

Best way to load balance across multiple static file servers for even an bandwidth distribution?

First off, I'll explain my situation to you. I'm running a fairly popular website as a side project, so I can't really invest a ton of money into it. I currently have just one server with HAProxy in ...
10
votes
4answers
7k views

haproxy + stunnel + keep-alive?

I'd like to put stunnel in front of haproxy 1.4 to handle HTTPS traffic. I also need stunnel to add the X-Forwarded-For header. This can be achieved by the "stunnel-4.xx-xforwarded-for.diff" patches ...
10
votes
1answer
12k views

HAProxy reqrep remove URI on backend request

real quick question regarding HAProxy reqrep. I am trying to rewrite/replace the request that gets sent to the backend. I have the following example domain and URIs, both sharing the same domain ...
9
votes
4answers
6k views

Dead gateway detection on Windows 2008 Server

We have recently implemented HAProxy for stackoverflow.com. We decided on using TProxy to maintain the source address for clients connecting so our logs and other IIS modules which depend on the ...
9
votes
4answers
2k views

Advantages of Using Nginx or HA Proxy as Load Balancer

In our environment we us both Nginx and HA Proxy on different clusters. Are there advantages of using one over the other? Or, what is the best way to go about load balancing a basic LAMP server ...
9
votes
3answers
33k views

haproxy and forwarding client IP address to servers

I have a problem with HAproxy. I use HAproxy as load balancer which distribute incoming http requests to 5 web servers. normally a client request's is forwarded to web servers with loadbalancer's IP. ...
9
votes
1answer
8k views

hardware recommendations for HAProxy for a small or medium traffic site

I am interested in setting up HAProxy for use as a load balancer for a set of small traffic web applications. The use is growing and might become medium sized in the near term (6 months or so). Mainly ...
9
votes
1answer
3k views

Using URL parameters for load balancing with HAProxy

I have a system which is load balancing via a cookie, but I want to use a URL parameter as an alternative. (Specifically, I have a front end app which does not support cookies). My setup is a little ...
8
votes
1answer
14k views

How to block IP addresses in HAProxy?

Is there something like Apache "deny from ip" in haproxy?
8
votes
6answers
3k views

why no examples of horizontally scalable software load balancers balancing ssl?

I have a bunch of questions with respect to ssl, local sessions, and load balancing which seem to be interconnected, so I apologize in advance for the length of this question. I have a website which ...
8
votes
2answers
1k views

Scale HAProxy for more than 64k websockets

We are trying to design an architecture that will be able to handle more than 64k websockets. We first tried with Amazon ELB, but its design doesn't allow unexpected spike of traffic nor websocket. (...
8
votes
2answers
10k views

HAProxy, health checking multiple servers with different host names

I need to load balance between multiple running servers with different host names. I cannot set-up the same virtual host on each one. Is it possible to have only one listen configuration with ...
8
votes
1answer
207 views

Set header key based on SSL ID

Is there a way to set a header key based on SSL ID value with HAProxy 1.5? We would like to use the SSL ID as the session ID for clients who do not support cookies.
8
votes
1answer
747 views

HAProxy URL rewrite on 404 error

How to make HAProxy rewrite to a different back-end when the first is missing the file? What I need is errorloc but making a rewrite instead of redirect, so the client is not aware of redirect. We ...
7
votes
1answer
25k views

Configure multiple SSL certificates in Haproxy

My haproxy instance serves 2 domains (mostly to avoid XSS on the main site). The rules look something like this bind :443 ssl crt /etc/ssl/haproxy.pem acl is_static hdr_end(Host) -i example.com ...
7
votes
1answer
17k views

How to add custom header containing the absolute address of the originally requested resource

I have the following setup: |-------|--- backend1:8080 example.com:80---|HAProxy|--- backend2:8080 |-------|--- backend3:8080 I would like to configure the HAProxy ...
7
votes
1answer
15k views

HAProxy - forward to a different web server based on URI

I have an HTTP farm with the following configuration: listen webfarm 10.254.23.225:80 mode http balance roundrobin cookie SERVERID insert option httpclose option ...
7
votes
2answers
7k views

Is there a way to configure HAProxy to send traffic based on a cookie?

When configuring HAProxy, I would like to send traffic to certain servers based on the presence of a cookie. For example: There is a HAProxy server and 2 web servers (serverA and serverB). When ...
7
votes
1answer
8k views

Basic Weight Questions with HAProxy

Do weights assigned to servers only effect the balance within that particular backend? When implementing weights for the first time, if I give all the servers in a backend the same number, would that ...
7
votes
1answer
2k views

Poor load balancer performance on rackspace and centos

I am load testing different options for load balancing, and am getting poor results from Nginx, haproxy, and varnish. I have one 4GB load balancer at Rackspace, hitting 4x1GB app servers. I'm ...
7
votes
1answer
1k views

Will this HAProxy “restart script” work as gracefully I think it will?

I put this script together from various places. What I am hoping is that it will do the following once run: Pause all "NEW" http traffic for ports 80 and 443 - just "pause" them, don't give any ...
7
votes
2answers
3k views

HAProxy SSL Farm Options

I am trying to figure out how to set up an SSL farm with haproxy and SSL reverse proxies and I am looking for some general advice: Is it possible to meet all of the following: Load balance requests ...
7
votes
1answer
615 views

HAProxy switch to backup on 500 errors and/or server down

I'm setting up an HAProxy in front of only 2 backend servers, with a particular configuration: any request should go to server A; but, if server A returns a 5xx error code, all request should go to a ...
6
votes
4answers
3k views

Load balanced IIS. Should I use NLB, or linux-based reverse proxy, or something else?

What would be the best approach for load-balancing at least 2-3 Windows 2008 R2 IIS webservers running a multitude of .NET applications? My choices appear to be: 1) Hardware-based network device load ...
6
votes
2answers
9k views

HAProxy HTTP vs TCP

HAProxy gives you the option to set the mode to TCP or HTTP. It also allows you to set the port. So why allow me to choose between HTTP and TCP, if it's letting me choose the port too? Surely if I ...
6
votes
1answer
7k views

Direct several subdomains to a single backend with haproxy

I'm using haproxy to direct route for several applications running on a single server. For one of the domains in use there are several dozens of subdomains that should be directed to one of a few ...
6
votes
2answers
2k views

Logging entire POST body with HAProxy?

I'm trying to track down some problems with the way a javascript client is interacting with an application server and would like to see the entire http payload (headers, body, and everything) that is ...
6
votes
1answer
13k views

How can I make haproxy route requests based on URL substrings?

A load balancer is set up with two back ends. The request URI will look like the following: http://example.com/answers/submit http://example.com/tag-02/answers/submit How can I configure haproxy ...