Forum Discussion
wtwagon_99154
Apr 21, 2011Nimbostratus
Looking to direct users to a server based upon URI
I'm an iRules and coding rookie, but I am trying to complete the following:
User will try to hit:
http://www.x.com/httm_TTT.xml.gz
Where the TTT can be one of the followi...
Joel_Moses
Apr 21, 2011Nimbostratus
Since you're not doing too many matches against the data, why not use switch instead?
when HTTP_REQUEST {
set default_pool [LB::server pool]
if { [string tolower [HTTP::uri]] starts_with "/httm_" } {
switch [string tolower [string range $test 6 8] ] {
"111" -
"254" -
"115" -
"114" -
"860" -
"103" {
pool qml01.80
}
"101" -
"219" -
"104" -
"759" -
"102" -
"725" {
pool qml02.80
}
"107" -
"c27" -
"119" -
"c28" -
"d01" -
"633" {
pool qml03.80
}
default {
pool $default_pool
}
}
} else {
pool $default_pool
}
}
This will switch pools based on the 3 characters in URIs that begin with "/httm_" while setting to the default pool for everything else.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