On Wed, Jul 16, 2008 at 01:12:42PM -0400, Mathieu Trudel wrote:
> Yes, I can. It's actually what I've decided to do in order to not have
> to recompile haproxy and redeploy it on all the machines that will be
> running the configuration. Since my configuration is being built by a
> perl script, readability of the generated configuration was less of an
> issue for me.
OK.
> This however comes to another question: is there a priority to the and
> and or clauses in the use_backend directive?
Just like in C, "and" has precedence over "or".
> For example:
>
> acl host_site_23 hdr(host) -i www.example.com
> acl host_site_24 hdr(host) -i www.example.fr
> acl static_site_23 path_beg /static
> use_backend example_static_backend if static_site_23 host_site_23 or
> host_site_24
> use_backend example_backend if host_site_23 or host_site_24
>
> Would this be evaluated as "www.example.com/static" or "www.example.fr",
yes, this one.
> or as being "www.example.com/static" or "www.example.fr/static", or not
> unless I added the implicit and of static_site_23 to each "host*" acl
> like this:
>
>
> use_backend example_static_backend if static_site_23 host_site_23 or
> static_site_23 host_site_24
you need this one, but see below.
> My goal is to have the same site available through completely different
> domain names, but with the same functionality in terms of forwarding to
> a separate backend for static content. At the same time, I do realize
> that I would have to always have the more specific use_backend
> directives for static content first, and then the others.
Then why not declare the same ACL multiple times with all domain names ?
acl host_site_example hdr(host) -i www.example.com acl host_site_example hdr(host) -i www.example.fr acl static_site_23 path_beg /static
or even :
acl host_site_example hdr(host) -i www.example.com www.example.fr acl static_site_23 path_beg /static
Regards,
Willy
Received on 2008/07/16 20:07
This archive was generated by hypermail 2.2.0 : 2008/07/16 20:15 CEST