Forum Discussion
Robert_47833
Jun 03, 2011Altostratus
switch -glob to match two or more than two conditions
Hi,I wanna to achieve this ,use switch -glob instead of if/else chain
if { [[TCP::local_port clientside] != 443] && [[HTTP::uri] starts_with "/mobile/auth"] }
{
HTTP::redirect "https://[getfield [HTTP::host] ":" 1]/[HTTP::uri]"
log local0. "here i am 1 [HTTP::uri]"
}
else
{
persist none
SSL::disable serverside
pool SRWD32-STATIC
log local0. "here i am 2 [HTTP::uri]" }
}
but how to achieve this cause we need to match 2 conditions here.
- hooleylistCirrostratusA switch will only allow you to check one string to see if it matches specific cases. You can't check the TCP::local_port value and the URI. So what you have there is as good as it gets.
- Robert_47833Altostratusthanks very much
- Colin_Walker_12Historic F5 AccountAaron's point is a good one. The switch command, while efficient and wonderful (I'm a fan, what can I say?) does have limitations. When trying to compare multiple pieces of information you're going to be nesting switches quickly and that can get messy. Ifs can be better in these cases if you're dealing with small numbers of matches (like one).
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