Forum Discussion
mnb_63148
Nimbostratus
Jul 14, 2015iRule sending traffic to wrong pool
I have an iRule where I am trying to send the traffic to a specific pool if the iRule contains a specific URI (/MyExample in this instance). The URI being requested by the application is /MyExample/a...
Kevin_Stewart
Employee
Jul 14, 2015Here's your iRule reformatted for easier viewing:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/MYExample*" {
pool example_pool
}
}
switch -glob [string tolower [HTTP::path]] {
"/" {
HTTP::respond 301 "Location" "http://[HTTP::host]/abc/"
}
default {
pool abc.com_pool
}
}
}
So a few comments:
-
HTTP::uri and HTTP::path will return pretty much the same information up to any query string data, and since you're only looking for the beginning of any URI, you could combine these two switches and just use HTTP::uri (or HTTP::path).
-
You don't need to do a [string tolower ] if you're only evaluation is "/"
-
You absolutely need OneConnect enabled
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
