User-Agent Irule to avoid APM policy
Dear Community,
We have scenario like when users access the url from laptops or PCs APM policy needs to take if any mobile handsets it shouldn't. We have applied the iRule but after this not able to access from laptops or PCs. Please suggest any changes in Irule.
But in Netscaler the below expression was working find:
Netscaler Policy
http.REQ.hostname.eq("test.net")) && (HTTP.REQ.HEADER("User-Agent").CONTAINS("iPhone") || HTTP.REQ.HEADER("User-Agent").CONTAINS("iPad") || HTTP.REQ.HEADER("User-Agent").CONTAINS("Android") || HTTP.REQ.HEADER("User-Agent").CONTAINS("Windows Mobile") || HTTP.REQ.HEADER("User-Agent").CONTAINS("Windows Phone") || HTTP.REQ.HEADER("User-Agent").CONTAINS("nintex-mobile") || HTTP.REQ.HEADER("User-Agent").CONTAINS("nintex-tablet"))
when HTTP_REQUEST {
switch -glob [HTTP::header User-Agent] {
"*iphone*" -
"*ipod*" -
"*android*" -
"*Windows Mobile*" -
"*Windows Phone*" -
"*nintex-mobile*" -
"*nintex-tablet*" -
{
pool Test-pool
}
}
}
What do you mean with 'avoid APM policy'? If you want to disable the APM policy for some devices you can use the ACCESS::disable command. See: https://clouddocs.f5.com/api/irules/ACCESS__disable.html
For the iRule, try this:
switch -glob [string tolower [HTTP::header "User-Agent"]] { "*iphone*" - "*ipod*" - "*android*" - "*windows mobile*" - "*windows phone*" - "*nintex-mobile*" - "*nintex-tablet*" { pool Test-pool } default { } }