Forum Discussion
Redirect multiple CNAME to a pool
Hello,
Just want to ask for your thoughts on what would be the quickest way to redirect multiple CNAME for our website to specific pool?
For instance, we have cname1.site.com, cname2.site.com and so on and want to redirect them all into a specific pool.
Thanks for you input.
Best
- Simon_BlakelyEmployee
You can specify a condition to match on the HTTP Host header, and the action is to forward the traffic to a specific pool.
- lorenzeAltocumulus
Should be something like this?
when HTTP_REQUEST { if { [HTTP::host] eq "cname1.site.com" "cname2.site.com} { pool pool_name } }
- Simon_BlakelyEmployee
It will be easier to manage if you create a datagroup (type string) to hold the CNAMES, and match against the datagroup.
when HTTP_REQUEST { # cname_dg is a datagroup of type string containing matching cnames if { [HTTP::host] equals cname_dg} { pool pool_name } }
- lorenzeAltocumulus
,
Thanks for pointing that out. I haven't really think of it or if that is even possible. Quick question though, Does the string and value on creating DG needs to match or just adding the cnames as the string would be all good?
Thanks again , Really appreciate it
- lorenzeAltocumulus
,
Thank! I tried your recommendation but I'm having issues on making it work.
- Simon_BlakelyEmployee
when HTTP_REQUEST { # jt_cname_dg is a datagroup of type string containing matching cnames log local0. "hostname [HTTP::host]" if { [class match [string tolower [HTTP::host]] equals jt_cname_dg]} { log local0. "matched datagroup" pool jt_pool } else { log local0. "no datagroup match" } }
I missed the class match
- lorenzeAltocumulus
Thanks ,
Actually I was thinking if its possible if we can redirect anything that is not equal to mydomain.com into a specific pool instead? is that something possible
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com