Forum Discussion
Brent_Sachnoff_
Nimbostratus
Oct 23, 2007Using switch with uri
I'm having some issues using the switch command and uri's. I believe the switch command is only for EQUALS to something for it to work properly which means this wouldn't work at all. Here is a sample...
hoolio
Cirrostratus
Oct 31, 2007You can test this by using a test string and a switch statement in the RULE_INIT event:
when RULE_INIT {
set ::test_uri /search/blah
log local0. "test string: $::test_uri"
switch -glob $::test_uri {
/search/blah* { log local0. "matched /search/blah*" }
/search/blah/foo* { log local0. "matched /search/blah*" }
/search/blah* { log local0. "matched /search/blah*" }
default { log local0. "didn't match any"}
}
}From the command line, you can run 'tail -f /var/log/ltm' to see the log statements.
If you want two different actions for /search/blah* and /search/blah/newsearch/search/*, you could either put *newsearch* before /search/blah* or make /search/blah* more specific so it doesn't match /search/blah/newsearch/search/*.
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