Forum Discussion
iRule Help
I'm trying to create a rule that will do redirections base on certain words are contain in the URI, but not sure where to start or what is going on as only one argument is working (test.123.tree) and the two other isn't working. Is there something wrong with my code?Here is the scenerio:
When a end user enters these variations in the URL, it will redirect to a abc pool. Otherwise, all else goes to xyz pool
test.123.com/nice* test.123.com/tree* test.123.com/green* redirect it to abc pool
Otherwise, everything else goes into xyz pool
if {[string length [HTTP::host]]}{
Redirect to the requested host and URI (minus the port if specified)
if {[HTTP::uri] contains "nice"} {
pool abc }
elseif {[HTTP::uri] contains "green"} {
pool abc }
elseif {[HTTP::uri] contains "tree"} {
pool abc }
} else {
Redirect to this Pool Member
pool xyz
}
}1 Reply
- Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/nice*" - "/green*" - "/tree*" { pool abc } default { pool xyz } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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