Forum Discussion
Dan_Hughes_1946
Nimbostratus
Jan 06, 2010loadbalanced redirection
Howdy,
Wondering if anyone can suggest a solution to a little problem I have. I want traffic coming into an LTM to be redirected to one of two URLs - based on a round robin loadbanace. ...
The_Bhattman
Nimbostratus
Jan 06, 2010Hi Dan,
I suppose you can try the following untested example:
when HTTP_REQUEST {
set turnbit [expr [STATS::get "roundrobin" turnbit] %2]
switch $turnbit {
0 {
log local0. "$turnbit"
HTTP::redirect "http://firsthost.domain.com"
STATS::incr "roundrobin" turnbit
}
1 {
log local0. "$turnbit"
HTTP::redirect "http://secondhost.domain.com"
STATS::incr "roundrobin" turnbit
}
}
}
You have to assign a STATS profile to the VIP. In this example I called the STATS profile "roundrobin" with a field called turnbit.
What this does is that it stores a number and then it is incremented one after it's been evaluated by the expression using N mod 2.
Basically one person is directed to the first domain and another after him will be directed to second , 3rd will go back to the first domain and rotate in a round robin fashion. Of course this has been tested at all but I think it might come very close to what you could be looking for.
I hope this helps
Bhattman
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