How to load-balance with ha-proxy without cookies


I am currently using HAProxy in front of a group if IIS .NET application servers. An unforeseen problem has arisen: I am using cookies for load-balancing, this obviously doesn't work for browser that refuses the use of cookies (given the recent changes in cookie laws in the UK, lets not go into that here tough).

This is my current HAProxy config:

listen backend-servers

cookie bs insert
balance roundrobin 
option persist
option redispatch
server appserver1 cookie bs1
server appserver2 cookie bs2

I don't want to re-design the application so I would like to find a way around this in HAProxy.

There are a couple of options like balancing using source IP, or a string in the URL, but can you use more than one method in HAProxy? Can you configure a fall back method or alternative method like this?

Thank you

Best Answer

If the cookie doesn't get saved, then haproxy dispatches based on your balance keyword only, which is roundrobin.