Forum Discussion
Nick_Coelho_338
Dec 21, 2006Nimbostratus
else procedure undefined?
i have what I think is a simple iRule (i am a complete novice mind you). i can not get the else command to work. gives the following eror no matter what i do. sorry if i am just dense
010701...
Dec 21, 2006
If what you were trying to do with the else is to provide a "default" clause for the switch statement (ie. everything that doesn't match one of your previous comparisons), then you can make use of the built-in "default" keyword in the switch statement. "else" is part of the "if" clause, not switch.
Oh, and Deb is right that you'll probably want wildcards if you want your comparison to be like the "starts_with" operator.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/affiliates*" -
"/endpages*" -
"/friends*" -
"/images*" -
"/img*" -
"/inc*" -
"/includes*" -
"/maintenance*" -
"/outage*" -
"/popup*" -
"/referral*" -
"/sc*" -
"/servicestudy*" -
"/sitemap*" -
"/thrivent*" -
"/upgrade*" -
"/userControls*" {
pool Pool1
}
default {
HTTP::redirect "http://blahblah.com"
}
}
}
-Joe
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