Forum Discussion
iRule Behavior: Custom URI + Route to Different Pool
Given the iRule below - whenever I navigate to domain.com/blah/shortname1, the URI redirect is working but it's not pointing the reset to 'CUSTOM_POOL2'.
Defined within the Virtual Server, the traffic is doing to the default pool, CUSTOM_POOL1.
Can anyone tell me why this isn't working? THanks!
switch -glob -- [string tolower [HTTP::uri]] {
"/shortname1*" {
Do nothing
}
"/blah/shortname*" {
HTTP::uri "/ShortName1"
pool CUSTOM_POOL2
}
default {
HTTP::redirect "/ShortName1"
If you perform the redirect there's no reason to set the pool, because the client will redirect.
}
}
2 Replies
- giltjr
Nimbostratus
I might be missing something, but:
If somebody goes to /blah/shortname* do you want them to always go to CUSTOM_POOL2?
If so, you don't want to change the URL to /shortname1, because that will end up going to CUSTOM_POOL1.
The pool is assigned on EACH http request. If you want /blah/shortname* to always go to CUSTOM_POOL2, you will need to do something so that on each subsequent request the iRule knows that it should send it to CUSTOM_POOL2.
- Eric_St__John
Employee
This iRule will redirect all requests, except requests beginning with /shortname1 or /blah/shortname to /shortname1, which will select the default pool.
If the URI begins with /blah/shortname, the URI will be set to /Shortname1, and pool CUSTOM_POOL2 will be selected. This URI setting will occur between the BIG-IP and the pool CUSTOM_POOL2, no redirect will occur.
Is that what you intend to occur? If not, what do you want to happen with each request?
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