I'm setting up haproxy to use multiple backend servers but want one of them to handle particular requests:
backend bagend
mode http
balance roundrobin
option httpchk GET / HTTP/1.1\r\nHost:\ www.example.com
use-server app1_00 if { path_beg /frodo }
use-server app1_01 if { path_beg /frodo }
use-server app1_02 if { path_beg /frodo }
use-server app1_03 if { path_beg /frodo }
server app1_00 10.0.0.1:9100 check
server app1_01 10.0.0.1:9101 check
server app1_02 10.0.0.1:9102 check
server app1_03 10.0.0.1:9103 check
server app2_00 10.0.0.2:9100 check
server app2_01 10.0.0.2:9101 check
server app2_02 10.0.0.2:9102 check
server app2_03 10.0.0.2:9103 check
Will my use-server commands balance across all 4 backends on app1? Or do I need to do this a different way? It looks as though everything is going to app1_00
.
Best Answer
What you want to do is have an acl in the frontend send the request to a different backend based on the URL.
All request beginning with /frodo will hit only app1_00, app1_01, app1_02 and app1_03. All other requests will hit everything.