I have a couple HAproxy instances in front of several webservers. The HAproxies are receiving traffic from an ELB upstream. All HAproxies are identical.

I want to load balance and make sessions sticky based on the contents of a request header. In a nutshell, all requests with the same header value must go to, and stick to, the same backend server.

A configuration I'm thinking of (but I'm not 100% sure it's correct) might look like this:

backend be_http
 mode http
 balance hdr(X-Forwarded-For)
 hash-type consistent
 stick on hdr(X-Forwarded-For)
 server s1 x.x.x.x1:8080 check
 server s2 x.x.x.x2:8080 check
 server s3 x.x.x.x3:8080 check
 server s4 x.x.x.x4:8080 check

But here's my question. I have not one, but two HAproxy instances. Are they going to compute the hash the same way? In other words, for the same value of that header, is haproxy1 going to send the sessions to the same backend server as haproxy2?

I need both HAproxy instances to act consistent with each other. Stickiness based on header value must provide identical results across all HAproxy instances.

Keep in mind that the two HAproxy instances will split the traffic more or less equally, so they will see different requests. But all I need is that hash being computed exactly the same by both HAproxies, in a deterministic fashion based on A) header values, and B) content of the backend servers list.

Is that doable?

--
Florin Andrei
http://florin.myip.org/

Reply via email to