Forum Discussion
David_X_20743
Nimbostratus
Jul 24, 2008HTTP URI redirect
Hi
I am not sure if the following http uri redirect is possible or not.
Please give me a hint. Thanks
when the client request
http://test.com/test.html
The F5 will check the URI for test.html,
If matching, then rediect to
http://test.com/test1.html
http://test.com/test2.html
http://test.com/test3.html
with round robin Method.
Really confused here. If customers were asking for direct traffic to different pool, things will be lot easier for me. Do not know how to direct the traffic to three URI with round robin, please help. Thanks
- hoolio
Cirrostratus
Something like this?when RULE_INIT { Initialize a global counter set ::redirect_counter 1 } when HTTP_REQUEST { Check if URI is /test.html if {[HTTP::uri] eq "/test.html"}{ Redirect client according to the counter value HTTP::redirect "http://[HTTP::host]/test${::redirect_counter}" Increment the counter incr ::redirect_counter Reset the counter if it's over the limit if {$::redirect_counter > 3}{ set ::redirect_counter 1 } } }
when RULE_INIT { Initialize a global counter set ::redirect_counter 1 } when HTTP_REQUEST { Check if URI is /test.html if {[HTTP::uri] eq "/test.html"}{ Redirect client according to the counter value switch $::redirect_counter { 1 { HTTP::redirect "http://[HTTP::host]/testUrlOne" } 2 { HTTP::redirect "http://[HTTP::host]/testUrlTwo" } 3 { HTTP::redirect "http://[HTTP::host]/testUrlThree" } } Increment the counter incr ::redirect_counter Reset the counter if it's over the limit if {$::redirect_counter > 3}{ set ::redirect_counter 1 } } }
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