Forum Discussion
Freddy_Delgado_
Nimbostratus
Mar 31, 2014Irule with Multiple URL's
I'm trying to figure out how to configure a simple http redirect irule,
however the irule round robins 4 different URL's, does anyone know how to write this?
VIP 1.1.1.1 -----> www.abc.com
...
hoolio
Cirrostratus
Mar 31, 2014Cory you have a good example, but using a global variable will disable CMP for that virtual server and it will only run on the first tmm.
https://devcentral.f5.com/wiki/irules.cmp.ashx
Here's an example using a psuedo random number to select between the four URLs:
Based on https://devcentral.f5.com/wiki/iRules.ratio_load_balancing_using_rand_function.ashx
when HTTP_REQUEST {
Save a psuedo-random number between 0 and 1
set rand [expr { rand() }]
if { $rand < .25 } {
HTTP::redirect "http://www.1.com"
} elseif { $rand < .50 } {
HTTP::redirect "http://www.2.com"
} elseif { $rand < .75 } {
HTTP::redirect "http://www.3.com"
} else {
HTTP::redirect "http://www.4.com"
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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