3

I have 2 different tomcat servers: T1 , T2

My clients that refer to my load balancer are providing the url parameter called "gender" (0 - for Male users , 1 - for Female users). only the url parameter is different between a male and a female call.

I would like to balance with haproxy to T1, T2 according to the gender parameter. (Males will be redirected to T1, Females to T2)

How can i Achieve that?

Thanks

Urbanleg
  • 139
  • 1
  • 5

1 Answers1

6

Well, you don't say what version of HAProxy you're using, but assuming it's 1.5.x, you could use the urlp fetch method something like so:

acl IsMale   urlp(gender) 0
acl IsFemale urlp(gender) 1
use_backend T1 if IsMale
use_backend T2 if IsFemale

There's more details on the urlp fetch here.

GregL
  • 9,030
  • 2
  • 24
  • 35