Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

A load balancer is set up with two back ends.

The request URI will look like the following:


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.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You want to use ACLs:

backend be1 # this is your default backend
backend be2 # this is for /tag-02 requests

frontend fe
  default_backend be1
  acl url_tag02 path_beg /tag-02
  use_backend be2 if url_tag02

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.2 of the guide to know what to do with the ACLs.

share|improve this answer
Here's a link to ACL info in haproxy: code.google.com/p/haproxy-docs/wiki/UsingACLs –  DTest Aug 31 '11 at 19:58
@DTest - Those links are much more approachable than the plain-text guide. Thanks. –  natacado Aug 31 '11 at 20:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.