Hi,

On Wed, Jun 26, 2013 at 11:20:49AM +0200, [email protected] wrote:
> Hi folks,
> 
> i've a question regarding "use_backend" and how conditions are processed.
> 
> My Example:
> 
> 
> ----
> 
>  frontend http_in_01
> 
>      bind  1.2.3.4:80
> 
>      log     global
>      option  httplog
> 
>      capture request header Host len 32
>      capture request header User-Agent len 200
> 
>      reqidel ^X-Forwarded-For:.*
>      option forwardfor
> 
>      option http-server-close
> 
> 
>      acl  is_domain_abc.de  hdr_dom(host)  -i  abc.de
> 
>      acl  is_regex_matching  url_reg .....
>      acl  is_regex_matching  url_reg .....
>      acl  is_regex_matching  url_reg ....
>      acl  is_regex_matching  url_reg ....
>      acl  is_regex_matching  url_reg ....
>      .
>      .
>      ... another 10000 lines  is_regex_matching
> 
> 
> 
>      use_backend  webfarm01  if  is_domain_abc.de  !is_regex_matching
> 
> ---
> 
> 
> If the first condition in "use_backend" line is NOT met ( the domain in the
> HTTP-Request is not abc.de ),  is the processing for this "use_backend"
> line stopped or is the second condition ( the
> heavy regex acl)  processed anyway ? (and unnecessarily* *consume
> ressources )

no, it will not be processed. The ACLs evaluation stop at the earliest
possible time, which is :
  - when one ACL returns false in an AND condition
  - when one ACL expression returns true in an OR condition

They are always evaluated from left to right, which is why it's
important to put the cheapest ones and the least likely ones on
the left. In your case it's perfect.

Also, note that you can optimize your ACL by passing multiple
patterns on the same line. It will save some URL fetches since
the regex patterns will be applied in sequence to the same URL.

Regards,
Willy


Reply via email to