Hi Martijn,
You can use a regular expression with matches_regex:
when HTTP_REQUEST {
if { [HTTP::uri] matches_regex "(?i)^\/test\/.*id\=1234" } {
log local0. "URI matched regex: [HTTP::uri]"
pool http_pool
} else {
log local0. "URI didn't match regex: [HTTP::uri]"
pool other_pool
}
}
The regex: (?i)^\/test/\.*id\=1234
is broken down as:
(?i) - case insensitive comparison
^ - asserts that the following token is the first one in the string
\/ - literal forward slash
test - literal
\/ - literal forward slash
.* any number of non-line break characters
id - literal
\= - literal =
1234 - literal
I believe the regex libary is PCRE (Perl Compatible Regular Expression), but someone can correct me if I'm wrong.
Aaron