Forum Discussion
TMaCEvans_92750
Jan 17, 2011Nimbostratus
nesting switch within aif statement
I'm trying to nest a switch statement in a if statement but am getting a parse error
[parse error: PARSE syntax 302 syntax\ error\ in\ expression\ \"\ switch\ -glob\ \[string\ tolower\ \[HTTP::uri\]\]\ \{\n\t\t\""/fr/app*"\"\ -\n...\":\ variable\ references\ require\ preceding\ \$] [{ switch -glob [string tolower [HTTP::uri]] {
can anybody see my error or suggest a alternative method
when HTTP_REQUEST {
if { [URI::path [HTTP::path]] starts_with "/xyz/" || [HTTP::query] contains "xy=9" } {
if { [HTTP::method] equals "GET" && [HTTP::header exists "Upgrade"] && [HTTP::header Upgrade] contains "WebSocket" } {
HTTP::disable
}
pool pool3
} elseif { switch -glob [string tolower [HTTP::uri]] {
"/fr/app*"{ pool pool2 }
default{ pool Pool1 }
}
} else {
pool pool1
}
}
- Chris_MillerAltostratusWould you mind listing everything this rule should be doing? I'm having a bit of trouble deciphering it. :-P
- TMaCEvans_92750Nimbostratuswe have an application which uses websockets through various means we run these over port 80 due to firewall concerns
- TMaCEvans_92750Nimbostratussorry to clear up the nested if statement to start with
- Chris_MillerAltostratusHere's what I came up with.
when HTTP_REQUEST { if { [string tolower [HTTP::path]] starts_with "/xyz/" or [string tolower [HTTP::query]] contains "xy=9" } { if { [HTTP::method] eq "GET" and [HTTP::header "Upgrade"] contains "WebSocket" } { HTTP::disable pool pool3 } pool pool3 } else { switch -glob [string tolower [HTTP::uri]] { "/fr/app*" { pool pool2 } default { pool pool1 } } } }
- TMaCEvans_92750NimbostratusCheers now writen like that I see my obvious error Doh!
- Chris_MillerAltostratusPosted By TMaCEvans on 01/17/2011 09:02 AM
- Rajesh_D_5975NimbostratusHi,
- TMaCEvans_92750Nimbostratusif { [HTTP::method] equals "GET" && [HTTP::header exists "Upgrade"] && [HTTP::header Upgrade] contains "WebSocket" }
- Rajesh_D_5975NimbostratusHi,
- Rajesh_D_5975NimbostratusSorry posted twice. Removing the duplicate.
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