Hello,

if the redirection is domain based, you dont have to use "base", path doesn't seem to have any importance in your redirections.

you should try and check one of these :

   acl is_qx963 hdr_dom(host) -i  cccd.abc.com
   acl is_qx1033 hdr_dom(host) -i      d.abc.com

   redirect prefix https://<domain1> <https://%3Cdomain1%3E/> is_qx963
   redirect prefix http://<domain2> <http://%3Cdomain2%3E/> if is_qx1033


or

   acl is_qx963 hdr(host) -i -m str cccd.abc.com
   acl is_qx1033 hdr(host) -i -m str   d.abc.com

   redirect prefix https://<domain1> <https://%3Cdomain1%3E/> is_qx963
   redirect prefix http://<domain2> <http://%3Cdomain2%3E/> if is_qx1033


from the doc :

- "dom" : domain match : check that a dot-delimited portion of the contents exactly match one of the provided string patterns. This may be
              used with binary or string samples.

- "str" : exact match : match the contents against a string. This may be
              used with binary or string samples.

 -i : ignore case during matching of all subsequent patterns.

you can find all match methods in chapter 7 of documentation : Using ACLs and fetching samples

Le 02/12/2016 à 08:24, Qingshan Xie a écrit :
Hello Experts,

Tried to configure Haproxy to do redirections. discovered the ACLs have hijacking issue. Example below,

    acl is_qx963 base_reg  cccd.abc.com/?
    acl is_qx1033 base_reg        d.abc.com/?

    redirect prefix https://<domain1> <https://%3Cdomain1%3E/> is_qx963
    redirect prefix http://<domain2> <http://%3Cdomain2%3E/> if is_qx1033


We see qx963 is hijacked by qx1033. we input url as cccd.abc.com on browser ,it redirects to http://<domain2> <http://%3Cdomain2%3E/> instead of <domain1>. Is it because the "base_req" is not the right syntax for string match? Should I use "base" instead, or what the best syntax should be?

Many Thanks, Q.Xie


Reply via email to