Forum Discussion
C_D_18583
Nimbostratus
Aug 04, 2005IRule and Error Checking
Please See comments below
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/channel/" } {
pool QA1
}
elseif {[HTTP::uri] starts_with "/performance/" } {
pool ...
Aug 04, 2005
It seems that the ends_with operator isn't returning a boolean value (or at least that's what is being inserted into the logs) can't use non-numeric string as operand of "!"
while executing "if { ! [HTTP::uri] ends_with "/" }..."
maybe unRuleY can chime in as to why. Since it's not returning a boolean so you can't use the not operator with it.
But, you aren't out of luck, you can always use the built-in TCL string commands (Click here) to manipulate strings
Give this a try...
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/channel/" } {
pool QA1
} elseif {[HTTP::uri] starts_with "/performance/" } {
pool QA2
} elseif { [HTTP::uri] starts_with "/lead/" } {
pool QA3
} elseif { [string index [HTTP::uri] end] ne "/" } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]/"
} else {
discard
}
}
Now, you didn't state this, but your rule will only do the redirect if the above "starts_with" comparisions don't pass. If you want this to occur even on those uri's then you might want to move the ends_with piece to the beginning of the loop. Also, keep in mind, that some webservers won't like appending slashes to file name requests (ie. /dir/somefile.htm).
-Joe
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