10-Aug-2020 11:14
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
10-Aug-2020 14:00
You can specify a condition to match on the HTTP Host header, and the action is to forward the traffic to a specific pool.
10-Aug-2020
14:29
- last edited on
04-Jun-2023
21:20
by
JimmyPackets
Should be something like this?
when HTTP_REQUEST {
if { [HTTP::host] eq "cname1.site.com" "cname2.site.com} {
pool pool_name
}
}
10-Aug-2020
14:41
- last edited on
04-Jun-2023
21:20
by
JimmyPackets
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
}
}
10-Aug-2020
14:58
- last edited on
24-Mar-2022
01:05
by
li-migration
,
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
10-Aug-2020 15:04
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
10-Aug-2020
17:23
- last edited on
24-Mar-2022
02:08
by
li-migration
,
Thank! I tried your recommendation but I'm having issues on making it work.
10-Aug-2020
21:47
- last edited on
04-Jun-2023
21:20
by
JimmyPackets
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
11-Aug-2020
10:00
- last edited on
24-Mar-2022
01:05
by
li-migration
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