Forum Discussion
jay_41157
Nimbostratus
Dec 17, 2008double wildcard match for uri patterns
Hi,
Is it possible to use 2 wildcards when checking for a uri ?
For ex,
I want to look for
uri1abcURI2zzz
uri1xxxURI2wqq
...
hoolio
Cirrostratus
Dec 17, 2008If you have multiple patterns you want to check, a switch statement would help keep them organized:
when HTTP_REQUEST {
Check requested URI
switch -glob [HTTP::uri] {
"*pattern1* -
"*pattern2* -
"*pattern3* {
Execute this code for the first three patterns
HTTP::redirect "http://first_redirect.example.com"
}
"*pattern4* -
"*pattern5* {
Execute this code for the next two patterns
HTTP::redirect "http://second_redirect.example.com"
}
default {
Execute this code for the any cases that haven't been matched
HTTP::redirect "http://default_redirect.example.com"
}
}
}
Else, if you wanted to use a single if statement you could do something like this:
when HTTP_REQUEST {
Check requested URI
if { ([string match -nocase "portal/aaa/org/memberapp?*pageLabel=application*" [HTTP::uri] ]) \
or ([string match -nocase "*pattern2*" [HTTP::uri]]) \
or ([string match -nocase "*pattern3*" [HTTP::uri]])}{
log local0. "[IP::client_addr]:[TCP::client_port]: Matched check for [HTTP::uri]"
HTTP::redirect http://redirecttotaget
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects