Forum Discussion
scottl_82413
Nimbostratus
Feb 04, 2010Redirect via Round Robin
Hello,
I'm not sure if an iRule is the best way to do this, or if the LTM can handle it in a better way.
We're going to publish a single URL - www.url.com, but need to re...
Kevin_Stewart
Employee
Feb 07, 2010If I understand your question, you need each client to be redirected in turn? The CLIENT_ACCEPTED event would localize to a single client. For a much broader scope I think you'd need some state management, a global variable.
when RULE_INIT {
set ::c 0
}
when HTTP_REQUEST {
event enable
switch $::c {
0 {
HTTP::redirect "http://www1.url.com"
incr ::c
event disable
}
1 {
HTTP::redirect "http://www2.url.com"
incr ::c
event disable
}
2 {
HTTP::redirect "http://www3.url.com"
set ::c 0
event disable
}
}
}
** in testing the first version of this sample it occurred to me that the switch was firing for at least two conditions at a time (c = 0, then c = 1, etc.) - which makes sense considering my IE browser is opening two connections to the server simultaneously. So I added the event commands to shunt this behavior. You still probably want to first check for the [HTTP::host] before running this code so you're not creating a loop.
HTH
Kevin
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