cancel
Showing results for 
Search instead for 
Did you mean: 

Redirect multiple CNAME to a pool

lorenze
Altocumulus
Altocumulus

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

8 REPLIES 8

Simon_Blakely
F5 Employee
F5 Employee

Local Traffic Policies

 

You can specify a condition to match on the HTTP Host header, and the action is to forward the traffic to a specific pool.

lorenze
Altocumulus
Altocumulus

Should be something like this?

 

when HTTP_REQUEST {   if { [HTTP::host] eq "cname1.site.com" "cname2.site.com} {   pool pool_name   }   }

 

 

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 } }  

 

 ,

 

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

 

You just need the cname as the String: , and leave the value blank.

 

Oh - and you can match against a datagroup in a local traffic policy as well

lorenze
Altocumulus
Altocumulus

0691T000009hprnQAA.png ,

 

 

Thank! I tried your recommendation but I'm having issues on making it work.

 

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

lorenze
Altocumulus
Altocumulus

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