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.
I wonder what's the best way to go about this. Examples: Requests to http://www.sub.domain1.com should be redirected to http://sub.domain1.com Requests to http://www.sub.domain2.com should be redirected to http://sub.domain2.com Requests to http://www.sub.domain3.com should be redirected to http://sub.domain3.com and so on. What should be working I guess is this: frontend http-in bind *:80 acl condition1 hdr_dom(host) -i www.sub.domain1.com redirect prefix http://sub.domain1.com if condition1 acl condition2 hdr_dom(host) -i www.sub.domain2.com redirect prefix http://sub.domain2.com if condition2 acl condition3 hdr_dom(host) -i www.sub.domain3.com redirect prefix http://sub.domain3.com if condition3 Are there better ways of doing this? 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? Looking forward to always great suggestions from the community.

