If you attach that rule to a VIP with no default pool, the rule will answer requests made to the VIP with a host header value of wpad.internal with a URI of wpad.dat. If a request is made with a different host header value or a different URI, the request will be dropped because the rule will do nothing and there is no default pool to handle the request.
What type of aliases are you referring to? Do you want the VIP and rule to answer for more than just the /wpad.dat URI? If so, you can add more URI's using a switch statement:
when HTTP_REQUEST {
Check if requested Host header is wpad.internal
if {[string tolower [HTTP::host]] eq "wpad.internal"}{
Check the requested URI
switch -glob [HTTP::uri] {
"/wpad.dat*" -
"*cache1.pac" -
"*cache2.pac" {
HTTP::respond 200 content {
function FindProxyForURL(url, host) {
if(shExpMatch(host, "*[^0123456789.]*") == false)
if( isInNet\(host, "127.0.0.0", "255.0.0.0")
|| isInNet(host, "172.17.0.0", "255.255.0.0")
|| isInNet(host, "172.18.0.0", "255.255.0.0")
)
return "DIRECT"; \
else
return "PROXY proxygateway.internal:8080; DIRECT";}
}
default {
Take some default action?
}
}
}
}
One small question, as I still must use (to be sure, that all users are using correct and full path) this iRule with alias, how to add also host alias like cache.internal etc into this iRule?