Hi guys,
On Thu, Jul 18, 2013 at 09:18:48AM +0200, Jürgen Haas wrote:
> Hi Lukas,
>
> this is great, didn't know that there is a shortcut for ACL written in
> {...}. You're absolutely right that this is much more readable and also
> I don't need those unique variable names holding the TRUE/FALSE state
> for the ACL just for the next line. So, this is a perfect solution and I
> can confirm that the redirect is performed straight away.
>
> Just a small extra note for future reference of others: initially I
> included all the redirects after the "use backend" instructions and when
> I restarted HAProxy I got this warning:
>
> [WARNING] 198/091249 (12592) : parsing [/var/proxy/haproxy.cfg:55] : a
> 'redirect' rule placed after a 'use_backend' rule will still be
> processed before.
>
> So, I moved the redirects to before the first "use backend" and all
> works fine without any warning.
I'm verry happy this warning has served at least once, it was not an
easy one to implement and I thought it was really important.
Lukas, there is an (ugly) possibility to use regex when you have
to remap many domains. The principle is to rewrite the host header
into itself followed by something to retain the information about
the rewrite. Then you use "redirect scheme", which picks the Host
and the URI to rebuild a complete redirect. It is approximately
like this :
reqirep ^Host:\ www.(.*) Host:\ \1\r\nX-Rewritten:1 if { hdr_beg(host) -i
www. }
redirect scheme http if { hdr(x-rewritten) 1 }
Regards,
Willy