I need to configure HAProxy to forward requests of different paths to different backends, and some of the backends need to be load-balanced. So I've come across this question, and the solution provided there does work, but due to our conventions, I need to use listen
and use-server
instead of frontend
and use_backend
.
So right now I have something like this:
listen poq [url]:[port]
acl has_cool_url path_beg -i /cool
use-server cool if has_cool_url
server cool [ip]:[port] check
server default [ip]:[port] check
And I cannot use this:
listen poq [url]:[port]
acl has_cool_url path_beg -i /cool
use_backend cool if has_cool_url
use_backend notcool if !has_cool_url
backend cool
balance roundrobin
server first [ip]:[port] check
server second [ip]:[port] check
backend notcool
server third [ip]:[port] check
Because our conventions tell us to define everything within the listen
block.
So my question is: is there anything like this:
listen poq [url]:[port]
acl has_cool_url path_beg -i /cool
use-server {first, second} if has_cool_url
server first [ip]:[port] check
server second [ip]:[port] check
server default [ip]:[port] check
Where first
and second
are load-balanced using round robin?