i used switch here because i think it is a bit easier to read.
configuration
[root@ve11b:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
log local0. "uri = [HTTP::uri]"
switch [string tolower [HTTP::path]] {
"/test.html" {
switch [string tolower [URI::query [HTTP::uri] username]] {
"testuser" {
do something
log local0. "/test.html with username=testuser"
}
"testuser1" {
do something
log local0. "/test.html with username=testuser1"
}
default {
do something
log local0. "/test.html without username or with username but testuser/testuser1"
}
}
}
"/test1.html" {
do something
log local0. "/test1.html"
}
default {
do something
log local0. "default"
}
}
}
}
/var/log/ltm
Feb 28 22:32:12 ve11b info tmm[14159]: Rule /Common/qux : uri = /test.html?username=testuser
Feb 28 22:32:12 ve11b info tmm[14159]: Rule /Common/qux : /test.html with username=testuser
Feb 28 22:32:17 ve11b info tmm[14159]: Rule /Common/qux : uri = /test.html?username=testuser1
Feb 28 22:32:17 ve11b info tmm[14159]: Rule /Common/qux : /test.html with username=testuser1
Feb 28 22:32:25 ve11b info tmm1[14159]: Rule /Common/qux : uri = /test.html?username=somebody
Feb 28 22:32:25 ve11b info tmm1[14159]: Rule /Common/qux : /test.html without username or with username but testuser/testuser1
Feb 28 22:32:48 ve11b info tmm[14159]: Rule /Common/qux : uri = /test.html?surname=something
Feb 28 22:32:48 ve11b info tmm[14159]: Rule /Common/qux : /test.html without username or with username but testuser/testuser1
Feb 28 22:32:56 ve11b info tmm1[14159]: Rule /Common/qux : uri = /test1.html
Feb 28 22:32:56 ve11b info tmm1[14159]: Rule /Common/qux : /test1.html
Feb 28 22:33:04 ve11b info tmm1[14159]: Rule /Common/qux : uri = /abc.html
Feb 28 22:33:04 ve11b info tmm1[14159]: Rule /Common/qux : default