I want to create an irule for the below. Is it appropriate to have specific URI’s define going to the URI Pool or can we say anything with a URI goes to this pool. Everything else root of example.com goes to another pool
example.com goes to pool Example
and anything else example.com with any URI goes to pool URI_POOL
would this be appropriate:
when HTTP REQUEST { if {[string tolower [HTTP::uri]] contains "/*/}{ pool URI_POOL} else pool EXAMPLE }
Vijay_E
September 14, 2016, 5:59pm
2
when HTTP_REQUEST {
if { [HTTP::host] eq "example.com" } {
if { [HTTP::uri] eq "/" } {
pool POOL-EXAMPLE
} else {
pool POOL_URI-POOL
}
}
}
Hi Falooda,
you may try one of the snippets below…
Using asyntax:
[string match]
when HTTP REQUEST {
if { [string match "/*/*" [HTTP::path]] } then {
pool URI_POOL
} else {
pool EXAMPLE
}
}
Using asyntax:
[switch -glob]
when HTTP REQUEST {
switch -glob -- [HTTP::path] "/*/*" {
pool URI_POOL
} default {
pool EXAMPLE
}
}
Note: The first example has a slightly better performance.
Cheers, Kai