Forum Discussion
Ross_Fitheridge
Nimbostratus
Jul 13, 2007increment pointer in array
I am trying to redirect to one of any hosts, to give some form of basic load balancing, like round robin, otherwise it goes to the default pool.
I guess I need an array and a pointer to increment each time the redirect gets executed, and I want it to go back to the top of the array once it has reached the bottom. What I have written to give you the gist is:
when RULE_INIT {
list of hosts to redirect to sequentially
set ibewebserver [ list \
"ww1" \
"ww2" \
"ww3" \
]
}
when HTTP_REQUEST {
if { [findstr [HTTP::uri] "/" 1 "/"] equals "oldwebsite" } {
set $ibewebserver + 1
HTTP::redirect https://$ibewebserver.acme.com[HTTP::uri]
}
}
Another problem I have with this iRule is matching case, the "oldwebsite" sometimes is in uppercase, mixed case, and I keep finding oddities.
It seems really simple and I feel ashamed to ask, but I'm not a programmer, and looking through the forum and references I have not seen anything quite like it. I know I am way off the trail, but you will make a novice very happy.
RossF
- Ross_Fitheridge
Nimbostratus
thanks Joe,
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