Forum Discussion
j-boelhouwer_11
Nimbostratus
Jan 05, 2016iRule for HTTP redirect, destination address persistence based on HTTP::URI
Hi All,
I have been using an iRule to elect a pool member from a pool which is closest to the client based on the client ip address. Then an HTTP redirect would be send to that client to connect...
Kai_Wilke
MVP
Jan 05, 2016Hi Jeroen,
you could store the previous elections results for a given URI/Path into LTMs memory based [table] and then query the [table] on consecutive request before electing again.
when RULE_INIT {
set static::table_lifetime 86400 ; One day
}
when HTTP_REQUEST {
if { [HTTP::path] starts_with "/vod/" } then {
if { [set location [table lookup -notouch "redir_[HTTP::path]"]] ne "" } then {
HTTP::redirect $location
} else {
Insert your election code here
Change your code so that it stores the elected location into $location
table set "redir_[HTTP::path]" $location indef $static::table_lifetime
HTTP::redirect $location
}
}
}
Cheers, Kai
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