Hi Mike,
With 9.4 or higher, you could use an HTTP class with a host header filter that matches on IP addresses with a regex. The action on the class could be to use a pool with a dummy pool member or an HTTP redirect. The regex could be:
[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
Or this might also work depending on the regex parser:
(?:[0-9]{1,3}\.){3}[0-9]{1,3}
Or you could be less exact and more efficient and set the host header to match a string with three periods:
*.*.*.*
This assumes your web site shouldn't ever get referenced using more than the three fields in a subdomain (
www.example.com and not sub1.sub2.example.com or anything with more fields).
You could also use an iRule to do this. In that case, it would be relatively simple and efficient to use string match or scan to check the host header value isn't an IP:
when HTTP_REQUEST {
Check if the host header contains one or more alpha characters
if {not ([string match -nocase {*[a-z]*} [HTTP::host]])}{
Host was either empty or an IP address, take some action
}
}
Aaron