On Wed, May 28, 2014 at 2:03 PM, Steven Van Ingelgem
<[email protected]> wrote:
> Hi all,
>
>
> I created a lot of ACL's to select to which server a request needs to go.
> The issue I'm facing now is that I want to redirect my own request (based on
> IP) to 1 specific server.
>
> Optimally this would be:
> ================================
> acl goto_server1 hdr_beg(host) -i abc.
> acl goto_server2 hdr_beg(host) -i def.
> alc goto_test_server src 1.2.3.4
>
> use_backend TestServer if goto_test_server and ( goto_server1 or
> goto_server2 )
> use_backend Server1 if goto_server1 or goto_server2
> ================================
>
> This would redirect my own IP still to the errors if the server is not
> available.
>
>
> Thanks!

Hi Steven,

There is not way to use parenthesis in HAProxy when writing rules.
I would split content switching related to your TestServer in two:
================================
 acl goto_server1 hdr_beg(host) -i abc.
 acl goto_server2 hdr_beg(host) -i def.
 alc goto_test_server src 1.2.3.4

 use_backend TestServer if goto_test_server goto_server1
 use_backend TestServer if goto_test_server goto_server2
use_backend Server1 if goto_server1 || goto_server2
 ================================

Or you can specify a dedicated acl for test server urls:
================================
 acl goto_server1 hdr_beg(host) -i abc.
 acl goto_server2 hdr_beg(host) -i def.
 acl goto_servertest_url hdr_beg(host) -i abc. def.
alc goto_test_server src 1.2.3.4

 use_backend TestServer if goto_test_server goto_servertest_url
use_backend Server1 if goto_server1 || goto_server2
 ================================

Baptiste

Reply via email to