Forum Discussion
Not sure if you need a data group for that list of URLs as it's pretty small. If it will change frequently, then externalizing it might be a good idea. Something like this should get you going
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/marines*" -
"/mrt*" -
"/mrtnet*" -
"/mrtsurvey*" -
"/navy*" -
"/protected*" -
"/rto*" -
"/saat*" -
"/saat2*" -
"/sftfamily*" -
"/sftservice*" -
"/survey*" -
"/images*" -
"/resources*" -
"/mrtemail*" -
"/scripts*" -
"/styles*" -
"/trainingcenters*" -
"/ultimateme*" {
node 10.10.10.10 80
}
"/programs*" {
node 10.10.10.20 80
}
default {
node 10.10.10.30 80
}
}
}
This is assuming that the URLs you mentioned you want to match on partial matches, not exact. The "/Marines_" for instance would match any URL that starts with "/Marines". One caveat is that "/MRTABC" would match on "/MRT_" so you may need to clarify the matches a bit more to ensure you don't get any incorrect assignments.
Also, if it were me, I'd create 3 pools instead of a single pool with 3 members. Assign member 10.10.10.30:80 to the default pool for the virtual and then use the "pool" command instead of "node" in the first two cases. Also, if servers or IP's change, it's a pool configuration change, not an iRule change.
Hope this helps...
-Joe