I am very new to HAProxy. I spent a few hours trying to figure out how to do it but could not get any leads. My requirement is this:
If end point of request is /special then I need to check URL_PARAM.
For example: localhost/special?id=10
If id <=3 server1, if id > 3 and id <=6 server2 else server3
acl is_special path_beg /special acl small_id urlp_val(id) le 3 acl medium_id urlp_val(id) 4:6 acl high_id urlp_val(id) gt 6 use_backend bck1 if is_special small_id use_backend bck2 if is_special medium_id use_backend bck3 if is_special high_id default_backend bck_all
Then, create 3 backends: one for each case.
If you want to use regex on the query param, use
acl small_id urlp_reg(id) ^[0-3] acl medium_id urlp_reg(id) ^[4-6] acl high_id urlp_reg(id) ^[7-9]
stick, depending on what you're trying to do.