Forum Discussion
farache_28983
Jan 23, 2013Nimbostratus
Switch Statement - action
I am building an irule for a specific project and thought of doing a piece of it like this..
when HTTP_REQUEST priority 150 {
if { $preprodpoolcheck == 1} {
if {[class match [string tolower [HTTP::path]] contains Domain_collapse_uri_list]} {
set ASPserver 1
log local0.alert "Request is for ASP server"
} else {
[switch -glob [string tolower [HTTP::path]] {
"*.asp" -
"/images/*" -
"/extras/images/*" {set ASPserver 1}}]
[switch -glob [string tolower [HTTP::uri]] {
"*/default.asp" {set JSPserver 1}
default {set JSPserver 1}}]
}
}
log local0.alert "Selected Pre-Prod Servers"
}
Is this really possible? I would guess yes... but again i am not an expert...
I am getting this error in the logs
Rule /Common/pre-prod : PrePROD POOL is LIVE
Jan 23 17:55:15 tmm err tmm[9493]: 01220001:3: TCL error: /Common/pre-prod - invalid command name "" while executing "[switch -glob [string tolower [HTTP::path]] { "*.asp" - "/images/*" - "/extras/images/*" {set ASPserver 1}}]"
I want to set a value to a variable depending on the URL selected.
Any ideas?
- What_Lies_Bene1CirrostratusRemove the first [ from the following;
[switch -glob [string tolower [HTTP::path]] { [switch -glob [string tolower [HTTP::uri]] {
- What_Lies_Bene1CirrostratusAnd the last ] from this line;
default {set JSPserver 1}}]
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