Use acl in backend / shrink my config
Solution 1:
the right keyword is use-server
(notice that this is an dash and not an underscore like use_backend
. Now my Load is reduced and configs are smaller. I only searched for something like use_server...
So this is my working example:
listen myFrontend
bind 127.0.1.1:80
bind 127.0.1.1:443 ssl crt /etc/haproxy/ssl/myFrontend/myFrontend.pem
redirect scheme https if !{ ssl_fc }
use-server srv2 if { url_sub &mode=edit } or { url_sub &mode=create }
server srv1 1.1.1.1:10201 cookie srv1 ssl check
server srv2 2.2.2.2:10201 cookie srv1 ssl check backup
server srv3 3.3.3.3:10201 cookie srv1 ssl check backup
you can also use load-balancing there and stick with cookies if you like.
source: haproxy manpage | or use the pretty one :)