Forum Discussion
atoth
Cirrus
Aug 10, 2015How to do a NOT URI with switch -glob
There is a VIP with an irule on it using the switch -glob format. Something like
switch [HTTP::uri] {
"/foo/* -
"/bar/* { pool blah
} default { pool default
}
}
Now the application team tha...
VernonWells
Employee
Aug 10, 2015Without resorting to regular expression matching (which should be avoided), I believe there is no way to do the kind of negation that you are describing with a
switch. This leaves you with two options:
switch [HTTP::uri] {
"/bar/*" { pool blah }
default {
if { !([HTTP::uri] starts_with "/foo/") } {
pool blah
}
else {
pool default
}
}
}
or
if { [HTTP::uri] starts_with "/bar/" || !([HTTP::uri] starts_with "/foo/") } { pool blah }
then just set the VS default pool to "default". Unhappily, in this, you can't avoid the double-evaluation in the worst case.
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