Forum Discussion
Kai_Wilke
Jan 05, 2016MVP
Hi 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