Haproxy "use_backend" match order
Solution 1:
I don't know why it doesn't work for you, but the HAProxy documentation states:
There may be as many "use_backend" rules as desired. All of these rules are evaluated in their declaration order, and the first one which matches will assign the backend.
From: http://cbonte.github.io/haproxy-dconv/configuration-1.4.html#4-use_backend
Looking at your code:
acl url_a path_beg /a
acl dom_eye hdr_dom(host) -i www.mydomin.com
use_backend eye1 if dom_eye
use_backend eye2 if dom_eye url_a
I would expect the following results:
www.mydomin.com -> eye1
www.mydomin.com/a -> eye1
www.mydomin.com/a/b -> eye1
Because all of them match the first use_backend
.
If you change the config to:
acl url_a path_beg /a
acl dom_eye hdr_dom(host) -i www.mydomin.com
use_backend eye2 if dom_eye url_a
use_backend eye1 if dom_eye
I would expect these results:
www.mydomin.com -> eye1
www.mydomin.com/a -> eye2
www.mydomin.com/a/b -> eye2
Because only URL 2 and 3 match the first use_backend
.
Could you confirm this is not what happens in your config?