I’m trying to redirect a domain and 1 other subdomain of that domain, but it’s not working (2 other redirects work to https, but they’re both different domains from each other and from this domain in question) and I haven’t been able to find an example that matches my configuration.
Here’s a snippet of the code in the order the entries appear, but let me know if you think you need to see more of the code (a lot of front ends and backends exist).
acl is_test1.domain.com hdr_dom(host) -i test1.domain.com
acl is_domain.com hdr_dom(host) -i domain.com
redirect location https://test1.domainTwo.com/ if is_domain.com
redirect location https://test1.domainTwo.com/path/ if is_test1.domain.com
Also, how should www.domain.com be handled with this configuration? Do I need another acl for it?
Thanks!
Not sure if it's the most efficient setup, but the suggestion below is similar to what I have and it works.
The redirects should work from there as the acl's will match appropriately now. From my understanding of HAProxy, hdr_dom(host) will match any dot-delimited part of the domain (taking the more exact match) and hdr(host) will match if the domains are identical.