Forum Discussion
iRule Issue
For the rate shaping, your principal issue is that you are running 9.x. That version of code is well past end-of-life. Having said that, as Chris says (but with link to 9.x guide):
For the long or set, the use of a glob switch is generally more readable:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"www.careers.philips.com*" {
HTTP::redirect "http://www.philips.com/about/careers"
}
"www.peopleclick.com*" -
"eeosource.peopleclick.com*" -
"eeoanalytics.peopleclick.com*" -
"eeodiversity.peopleclick.com*" -
"generator.peopleclick.com*" -
"optimum.peopleclick.com*" -
"secure.peopleclick.com*" -
"strategichr.peopleclick.com*" -
"www.itiliti.com*" -
"www.eeosource.com*" -
"www.eeosource.net*" -
"www.eeosource.org*" -
"elearning.peopleclick.com*" {
pool CorpWeb
}
default {
pool ProdWeb
}
}
}
I assume you want the equivalent of starts_with rather than contains, but it is trivial to change the meaning.
But, as @drteeth (a dentist?) observes, matchclass is generally a superior way to achieve this sort of thing:
which would look something like this (assuming you've created a class called corp-web-hosts in which the indices are lower-case only hostnames):
when HTTP_REQUEST {
if { [HTTP::host] starts_with "www.careers.philips.com"} {
HTTP::redirect "http://www.philips.com/about/careers"
}
elseif { [matchclass host-match starts_with [string tolower [HTTP::host]]] } {
pool CorpWeb
}
else {
pool ProdWeb
}
}
Strictly speaking, the else conditional is not required if the default pool for the Virtual Server is already set to ProdWeb.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
