Forum Discussion
Cindy_127211
Nimbostratus
Apr 09, 2006Rule that redirects based on length of [HTTP::uri]
I have a rule in 4.5 that does the following, but cannot get the same rule to work in version 9.1.1. Can you tell me what I'm doing wrong for the 9.1.1 version?
Thanks!
Version 4.5.13
rule siebel_redirect_test {
if (http_uri > 1) {
use pool siebelqa
}
else {
redirect to "http://siebel-qa.americancentury.com/fins_enu/"
}
}
Version 9.1.1
rule siebel_redirect_test {
when HTTP_REQUEST {
if { [HTTP::uri] > 1 } {
use pool siebelqa
}
else {
HTTP::redirect "http://[HTTP::host]fins_enu/"
}
}
}
- hoolio
Cirrostratus
I think this should work for you: - Honestly, I'm not sure how your rule was working on 4.x becuase the http_uri value is a string and you are comparing it to a number. What you want is the string length. This should work for you using the builtin "string" TCL command.
when HTTP_REQUEST { if { [string length [HTTP::uri]] > 1 } { use pool siebelqa } else { HTTP::redirect "http://[HTTP::host]/fins_enu/" } }
when HTTP_REQUEST { if { [string length [HTTP::uri]] == 1 } { HTTP::redirect "http://[HTTP::host]/fins_enu/" } }
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