If you use load balance source and then cookies HAProxy will load balance based on the cookies and if they are not there (i.e. not supported by the client) then based on source IP. I think this is what you want right?
Sent from mobile, please excuse brevity/typos. ----- Reply message ----- From: "Jonathan Matthews" <[email protected]> To: <[email protected]> Subject: Tactics for load balancing all connections Date: Thu, Jan 17, 2013 20:39 On 17 January 2013 12:24, James Bensley <[email protected]> wrote: > Howdy All, > > I wondered if anyone could entertain me with some ideas and thoughts > on being able to load balance all connections that pass through > HAProxy, perhaps by using more that one method, to "catch all" > connections (I have a single box set up in mind which is troubling > me). I have placed a snippet of the config below. We are inserting a > cooking to the request, either s1 for server1 or s2 for server2 so > that customers are having sticky sessions with the web servers. For > customers that don't support cookies, the servers redirect the user to > a different URL that carries the session ID in the URL all throughout > the session (an SSL session is terminated in front of HAProxy, so > HAProxy is HTTP only below).In the cookie-less scenario we would like > to use source IP based balancing; whilst this isn't the most even > distribution of traffic, it will be a minority of traffic. > > So, can I enable two balancing techniques? Is there a way of having > priority based balancing so cookies are preferred, failing that, > source IP? From the fine documentation: ----------------------- appsession [snip] When an application cookie is defined in a backend, HAProxy will check when the server sets such a cookie, and will store its value in a table, and associate it with the server's identifier. Up to <length> characters from the value will be retained. On each connection, haproxy will look for this cookie both in the "Cookie:" headers, and as a URL parameter (depending on the mode used). If a known value is found, the client will be directed to the server associated with this value. Otherwise, the load balancing algorithm is applied. ----------------------- The "otherwise" caveat sounds like what you're looking for. Jonathan -- Jonathan Matthews // Oxford, London, UK http://www.jpluscplusm.com/contact.html

