Forum Discussion
Robert_47833
Sep 20, 2011Altostratus
how to merge these conditions to one :matches_regex
how to merge these conditions to one
if {$port == 443 and $uri matches_regex "^(/up)"} {
persist none
pool SRWD42-SLX
}
elseif {
$port == 443 and $uri matches_regex "^(/auto/bu)"} {
persist none
pool SRWD42-SLX
}
elseif {$port == 443 and $uri matches_regex "^/auto/Da"} {
persist none
pool SRWD42-SLX
}
and how to merge if it is start_with?
- Brian_69413NimbostratusThere is probably a more efficient way to do this, but:
if { ($port == 443) and (($uri matches_regex "^(/up)") or ($uri matches_regex "^(/auto/bu)") or ($uri matches_regex "^/auto/Da")) }{ persist none pool SRWD42-SLX }
if { ($port == 443) and (($uri starts_with "/up") or ($uri starts_with "/auto/bu") or ($uri starts_with "/auto/Da")) }{ persist none pool SRWD42-SLX }
- Brian_69413NimbostratusI created two code blocks and shown both ways, but the interpreter squashed it...I guess you get the idea.
- Robert_47833Altostratushmm,Brian
- Brian_69413NimbostratusYes, you could also do something like that...
- hooleylistCirrostratusI'd use a switch statement for this. It should be a lot more efficient than the regex checks.
if {[TCP::local_port] == 443}{ switch -glob -- [HTTP::uri] { "/up*" - "/auto/bu*" - "/auto/Da*" { persist none pool SRWD42-SLX } default { Take some default action? } } }
- Brian_69413NimbostratusNice, so the first two conditions fall through to the third...much cleaner I think...
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