If you want to check the URI for one string, you wouldn't reference the class or use matchclass. Also, if the above examples aren't working, break each check into a separate 'if' statement and add logging to figure out what's happening.
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: request to [HTTP::host], [HTTP::uri]"
if {[HTTP::uri] contains "/init/"]}{
log local0. "[IP::client_addr]:[TCP::client_port]: URI contained /init/, dropped request"
discard
}
}
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: -------------------------------------"
log local0. "[IP::client_addr]:[TCP::client_port]: \$::cm2prod_filtered_URI contents: $::cm2prod_filtered_URI"
log local0. "[IP::client_addr]:[TCP::client_port]: \$::corporate_external_net contents: $::corporate_external_net"
log local0. "[IP::client_addr]:[TCP::client_port]: request to [HTTP::host], [HTTP::uri]"
if {([matchclass [HTTP::uri] contains $::cm2prod_filtered_URI])}{
log local0. "[IP::client_addr]:[TCP::client_port]: matched URI to class
if {(not [matchclass [IP::client_addr] equals $::corporate_external_net])}{
log local0. "[IP::client_addr]:[TCP::client_port]: didn't match client to external networks class
discard
}
}
}
If the application is not case sensitive, you should set the output from [HTTP::uri] to lower case using [string tolower [HTTP::uri]].
The log output will be written to /var/log/ltm by default. You can run 'tail -f /var/log/ltm' from the command line to watch the output as you test. Hit Ctrl+c to stop the tail.
Aaron