A load balancer is set up with two back ends.
The request URI will look like the following:
http://example.com/answers/submit
http://example.com/tag-02/answers/submit
How can I configure haproxy in such a way that the request is sent to one or the other of the two back ends, depending on the format of the request URI? The only difference between the requests is /tag-02/
in the request URI.
A haproxy config file for this with a bit of explanation would be much appreciated, since I’m new to haproxy.
Best Answer
You want to use ACLs:
Section 7 of the HAProxy configuration guide has the details on ACLs, but you have to know the magic
use_backend
incantation hidden in section 4 of the guide to know what to do with the ACLs.