Forum Discussion
Redirection
Hi Sirisha,
you may use the iRule below as a starting point...
when RULE_INIT {
set static::load_value 10 ; Load Value in % percent (0-100 is valid)
}
when HTTP_REQUEST {
if { ( [string tolower [HTTP::host]] eq "abc.co.uk" )
and ( [expr { int(rand()*100) }] < $static::load_value } then {
HTTP::redirect "https://www.xyz.co.uk"
}
}
Note: The
syntax generates a random number in the range of [expr { int(rand()*100) }]
. If the generated number (e.g. 0-99
) is lower than the value of 0-9
(e.g. $static::load_value
), the request will become redirected to the new URL (e.g. https://www.xyz.co.uk). If the the generated number (e.g. 10
) is higher than or equals the value of 10-99
(e.g. $static::load_value
), the iRule will do nothing and let the request silently pass...10
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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