Hi Jürgen,

> In our environment, we do have a lot of subdomains on various servers
> and customers still tend to insert "www." in front of the domain name.
> We would like to get rid of them by redirecting to the proper subdomain
> without the leading www.
> [...]
>  acl condition1 hdr_dom(host) -i www.sub.domain1.com
>  redirect prefix http://sub.domain1.com if condition1
> [...]
> Are there better ways of doing this?

I would just transform them to one liners with an anonymous ACL, which is imo
more readable than an dedicated ACL later referenced in redirect statement:
  redirect prefix http://sub.domain1.com if { hdr_dom(host) -i 
www.sub.domain1.com }

It would be even nicer if we could do this with a single regexp instead of
a per domain declaration, but I don't think thats currently possible.



> Am I right, that the redirect isn't performed immediately and that
> HAProxy goes through all subsequent declarations in that frontend before
> closing the connection? If so, we could potentially end up with
> double-matches, right?

I don't think so. After the first "redirect" match, no other redirect
statement should be processed.

I cannot produce double matches even when trying.




Regards,

Lukas                                     

Reply via email to