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....
Apr 09, 2006
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/"
}
}Note, I added an extra slash in your redirect after the HTTP::host value. I was assuming you are redirecting to the same host with the /fins_enu/ path. If you are trying to append "fins_enu/" to the host value then leave it as is.
BTW, you could make the rule much simpler if you set the default pool on your virtual server to "siebelqa". Then your rule could look like this
when HTTP_REQUEST {
if { [string length [HTTP::uri]] == 1 } {
HTTP::redirect "http://[HTTP::host]/fins_enu/"
}
}-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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