Questions tagged [haproxy]

HAProxy is an 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.

Filter by
Sorted by
Tagged with
53 votes
3 answers
132k 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 ...
user avatar
55 votes
5 answers
26k 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 ...
Joel K's user avatar
  • 5,903
50 votes
7 answers
74k 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! ...
isNaN1247's user avatar
  • 1,705
16 votes
3 answers
33k 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 ...
mixdev's user avatar
  • 383
7 votes
3 answers
17k views

Is it possible to make redundancy on HAProxy server?

I am going to use HAProxy as a load balancer that will balance requests on 3 application servers. But what if balancer server (HAProxy) fails at some point? I was thinking of cloning the first ...
wael34218's user avatar
  • 341
55 votes
5 answers
89k 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 ...
Conor Taylor's user avatar
18 votes
1 answer
36k 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 ...
Bosky's user avatar
  • 315
7 votes
2 answers
7k views

Prevent HAProxy from toggling back from fallback to master

We have Redis master-slave setup, and we want to fallback to the slave once the master failed. But if it has failed it should never toggle back, even if the master is online again. Is this possible?
grosser's user avatar
  • 277
6 votes
2 answers
7k views

mod_evasive behind HAPROXY

I have a couple of Apache 2 machines behind an HAPROXY setup, I tried to setup mod_evasive on those Apache machine while also using mod_rpaf to get the real X-FORWARDED client ip. For some reason, ...
Elad Meidar's user avatar
3 votes
4 answers
19k views

Using HaProxy environmental variables in haproxy.cfg not working

Trying to figure out why environmental variables in haproxy.cfg aren't working in HA-Proxy version 1.5.2 on the command line, using Printenv I get a list of environmental variables like ...
TroyWorks's user avatar
  • 153
31 votes
3 answers
54k 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 ...
Jim's user avatar
  • 988
27 votes
1 answer
95k views

HAProxy to terminate SSL also send SSL to backend server

I would like terminate SSL at HAProxy, do some manipulation on the header, rewrite URL and re-encrypt traffic and send to backend servers as SSL? I can't seem to find a way to do this. I can get ...
oazabir's user avatar
  • 415
20 votes
2 answers
51k 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 ...
marflar's user avatar
  • 397
20 votes
6 answers
87k 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 ] ...
Josh's user avatar
  • 9,208
18 votes
3 answers
104k 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. ...
System's user avatar
  • 507
15 votes
3 answers
12k views

haproxy timing connection diagram

I'm trying to understand more about the Haproxy timings. Below is a snippet of the timings from the Haproxy manual: Tq: total time to get the client request (HTTP mode only)... Tw: total time ...
Chris Snow's user avatar
14 votes
2 answers
26k views

HAproxy subdomain redirect

I own one domain like xyz.com and I'm trying to redirect subdomain other ip with haproxy. I use tomcat on the servers and I use haproxy to redirect incoming requests on port 80 to port 8080. Like; ...
psce's user avatar
  • 171
10 votes
3 answers
17k views

Load Balancing DNS Servers: UDP / TCP

I have been asked to rebuild our load balancing infrastructure in the data center. The original request was to load balance FTP servers. I tried doing that using the current load balancer (Piranha / ...
moshpitcodes's user avatar
9 votes
2 answers
51k views

Configure HAProxy to include host headers for different backends

I am exploring the use of HAProxy as a balancer in front of a set of web apis that run on IIS. node1.myapp.mycompany.com node2.myapp.mycomapny.com We are currently using Host Headers to correctly ...
Matt's user avatar
  • 3,251
6 votes
1 answer
7k views

How can I use environment variables in haproxy.conf

My haproxy.cfg file has one backend servers using hostnames: backend servers server myapp ${PORTAL_PORT_3000_TCP_ADDR}:${PORTAL_PORT_3000_TCP_PORT} maxconn 32 myapp is running in other docker ...
Montells's user avatar
  • 165
6 votes
1 answer
55k views

HAProxy not passing SSL traffic in TCP mode (unknown protocol)

I've got a HAProxy LB solution setup and working correctly. All HTTP traffic on port 80 is being passed through succesfully. I'm now trying to get SSL traffic to work (in TCP mode and on just one ...
outeredge's user avatar
  • 391
6 votes
2 answers
7k views

Weird interaction with systemctl with Haproxy on CentOS 7

Running haproxy through systemctl is different than running it manually. on manual start, everything works. starting through systemctl, haproxy is not able to find the service it proxies, and answers ...
Magnar's user avatar
  • 1,047
5 votes
1 answer
3k views

HAProxy returns error if server goes down before health check has occured

Let's say I have web01 in my list of backend servers, and web01 goes down. It will take a few seconds for HAProxy to notice the server is down (depending on the health check interval and how long the ...
Mike Christensen's user avatar
5 votes
3 answers
8k views

SSHD real-ip behind haproxy

I'm trying to setup an ssh over https connection using haproxy. I'm currently looking for a way for SSHD to get the source ip from haproxy, similar to reading X-Forwarded-For or X-Real-IP headers. ...
Thermionix's user avatar
5 votes
2 answers
29k views

HAProxy with SSL and sticky sessions

We're trying to set up HAProxy (v1.5.1) to use SSL. While we managed to do that, we're having some issues with the round robin settings: We do want to have stick sessions, but haproxy seems to send ...
Ayelet's user avatar
  • 151
4 votes
1 answer
8k views

Redis sentinel + HAProxy failover

I am looking to implement a HA redis implementation using Master-Slave redis servers. The web servers will connect to these through an HAProxy instance installed on each box. The situation is easy ...
JonoCoetzee's user avatar
3 votes
1 answer
4k views

Why am I getting errors in my HAProxy content switching config?

I'm migrating some infrastructure from multiple servers hosting specific sites to a load-balancing architecture using HAProxy 1.3.15.7 on OpenBSD 4.6 macppc. Naturally, I'm starting with configuring ...
morgant's user avatar
  • 1,470
2 votes
1 answer
3k views

Can NGINX inspect the TLS request to look for SNI like HAProxy (etc) does?

It seems that, when configuring HAProxy for hostname routing on HTTPS connections, it is crucial to include a tcp-request inspect-delay directive to "give HAProxy a chance to look into the connection"....
Morpheu5's user avatar
  • 269
2 votes
1 answer
4k views

prevent X-Forwarded-For spoofing in haproxy

Yesterday we got hit by a DDoS attack reaching our webserver backends (apache2). The frontend consists of haproxy loadbalancing connections to the webservers. On access.log of apache we saw thousands ...
giomanda's user avatar
  • 1,824
2 votes
2 answers
4k views

HAProxy as reverse proxy for AWS API Gateway

As the title suggest, I have an AWS API Gateway endpoint that I want to put behind HAProxy. This is my current HAProxy configuration defaults mode http log ...
Rudy Lee's user avatar
  • 165
2 votes
1 answer
564 views

How to share local IP within a cluster if server is bound to one IP?

I have a cluster with 3 nodes running in VMs on test setup. Now I want to take it to production and rented 3 dedicated root servers at Hetzner Online connected by a switch. As I found out, they do ...
merlin's user avatar
  • 2,172
2 votes
2 answers
2k views

Change backend when reaching maxconn HAProxy

I have just started using HAProxy, and I am building a real-time chat application. I wonder if it is possible to send clients to another backend when the current backend reaches its maxconn (I am ...
laoshanlung's user avatar
2 votes
1 answer
5k views

HAProxy SSL roundrobin not working when SSL terminated and forwarded

I am using the following config to terminate SSL so that I can inspect the request, do URL rewriting, ACL etc, and then forward the SSL traffic back to my backend servers. However, I am not able to ...
oazabir's user avatar
  • 415
2 votes
1 answer
2k views

HAProxy use urls in server config?

Right now, my config looks like this: server node1 10.20.x.y:80 check server node2 10.20.x.y:80 check server node3 10.20.x.y:80 check What would be the best way to use URLS here instead of IPs? ...
SnIpY's user avatar
  • 123
1 vote
2 answers
7k views

Mysterious HAProxy request errors

I see tons of request errors on one of my frontend proxies (on the order of a few per second), but I can't figure out what's causing them. I've tried using the "show errors" command on the stats ...
Mike Conigliaro's user avatar
1 vote
2 answers
4k views

HAProxy encode url for querystring

I have a system that needs to preserve the original referer over multiple redirects. To achieve this I'm trying to write the referer to the URL query string. I already got that working (somewhat). ...
elmo's user avatar
  • 55
0 votes
2 answers
3k views

HaProxy using IIS on same port with different host headers [duplicate]

I'm running version HA-Proxy version 1.8.12-1ppa1~bionic 2018/06/27 on Ubuntu. I'm trying to load balance requests to load.mysite.com to two different windows servers with IIS. The servers also have ...
MonkeyDreamzzz's user avatar
43 votes
2 answers
60k 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. ...
Jeremy Wadhams's user avatar
33 votes
2 answers
30k 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 ...
LostInComputer's user avatar
33 votes
4 answers
43k 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?
Quintin Par's user avatar
  • 4,443
27 votes
3 answers
66k 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 ...
Lars Schneider's user avatar
24 votes
2 answers
34k 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 ...
w00t's user avatar
  • 1,164
22 votes
3 answers
38k views

How can I use a custom 503 error document when HAProxy sends a 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 ...
Marcin's user avatar
  • 613
20 votes
8 answers
59k 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 ...
Neil Middleton's user avatar
20 votes
2 answers
21k views

Is it possible to use multiple load balancers to redirect traffic to my application servers?

I'm new to load balancing and I'm wondering if it's possible to use multiple load balancers to redirect traffic to my application servers. I don't really understand how this can be done. Shouldn't a ...
user3790827's user avatar
19 votes
3 answers
69k views

How do I match a wildcard host in ACL lists in HAproxy?

I have the following lines in my haproxy.conf: acl valid_domains hdr(Host) -i mysite.com images.mysite.com docs.mysite.com admin.mysite.com redirect location http://mysite.com/invalid_domain if !...
Tom's user avatar
  • 731
19 votes
4 answers
114k views

Haproxy not logging requests?

So, I configured Haproxy so the logging would go through rsyslog and, for now, be all dumped in one file. It's definetly logging, as I get those "starting" messages on startup, but no HTTP requests ...
Silver Quettier's user avatar
18 votes
4 answers
162k views

HAProxy logging to syslog

I installed HAProxy 1.5 via apt-get on ubuntu 14.04 via ppa:vbernat/haproxy-1.5 as per this Debian repository selection tool. The problem is it logging to /var/log/syslog instead of /var/log/haproxy....
Petah's user avatar
  • 650
17 votes
1 answer
64k views

HAProxy ACL multiple OR conditions

Using Haproxy 1.5.12 running on Ubuntu 12.04 I need to restrict access to my website to requests either coming from certain IPs or having a defined parameter in the request. So for example the ...
jeremyjr's user avatar
  • 375
16 votes
2 answers
36k views

HAProxy switch only in case of server down

Let's say I have 2 servers - SA and SB. Is it possible to configure HAProxy to work like this: All connections goes to SA -> SA goes down -> HAProxy switches all connections to SB -> until SB is not ...
Joe's user avatar
  • 323