Forum Discussion
Kai_Wilke
Jan 12, 2017MVP
Hi Allan,
which TMOS version are you running on? I'm asking because the
[findclass]
command and the way you're referencing the data-group (aka. via $::datagroup
) is deprecated since may years and would harm CMP-operations on current TMOS versions.
If you've loaded a TMOS version v10 or higher on your box, then the take a look to the iRule below. It uses the CMP-friendly
[class]
syntax to lookup the data-group containing the domain-to-pool information.
ltm data-group internal DG-HTTPSPool {
records {
"domain.com" {
data "pool-domain.com"
}
"domain.net" {
data "pool-domain.net"
}
}
type string
}
when HTTP_REQUEST {
if { [set pool [class match -value [domain [string tolower [getfield [HTTP::host] ":" 1]] 2] equals "DG-HTTPSPool"]] ne "" } then {
pool $pool
} else {
HTTP::respond 403 content "Access denied - Invalid HOST-name requested" "Content-Type" "text/html"
}
}
Cheers, Kai