Forum Discussion
ASMAPMLTM
Sep 01, 2023Altostratus
Loadbalance a URL to 3 URLs
Hi Guys, I have a requirement like when HTTP_REQUEST { if { [HTTP::path] equals "/exampletext" it should loadbalance/roundrobin the redirection to 3 URLs shown below "https://abc1ee.xyz.com/exam...
ragunath154
Sep 02, 2023Cirrostratus
you can use the RAND funtion in irule ,try below irule
when HTTP_REQUEST {
# Generate a random number between 1 and 3
set random_num [expr {int(rand() * 3) + 1}]
if {[string tolower [HTTP::path]] eq "/exampletext"} {
HTTP::redirect http://abc$random_num\ee.xyz.com/exampletext_$random_num
}
}
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