Forum Discussion
I'm a little unclear on what you are trying to do. How is it that all those domains are routing to your servers? Are you saying that someone has updated DNS entries for other domains to point to your VIP? From the look of the iRule, you want to blacklist certain host headers coming in. The datagroup approach should work for you, not sure why it isn't. I can say why the if approach isn't working. You are nesting all the if's inside eachother so that will equate to a big ANDed list. - if ( (host equals "one") AND (host equals "two") AND (host equals "three") ...). That will never succeed because it can't be both. You'll either have to include logical ORs between the comparisons, use a switch statement, or move to a whitelist approach where you list only the hosts you do want in. That way you aren't chasing new values down the road.
Here's a couple of ideas
if { ([HTTP::host] equals "homesearchcar.com") || ([HTTP::host] equals "globe7.com") || ....} {
reject
}
The switch would look like this
switch -glob [HTTP::host] {
"homesearchcar.com" -
"globe7.com" -
"www.globe7.com" -
"*mmadsgadget.com" {
reject
}
}
Or you could do a whitelist where you only allow in good host
switch -glob [HTTP::host] {
"goodhost1.com" -
"goodhsot2.com" -
"goodhost3.com" {
allow through
}
default {
reject
}
}
Hope this helps...