Forum Discussion
Erik_Durand_277
Nimbostratus
Aug 31, 2008uri redirect to pool
I am an iRule novice and I am trying to create an iRule that will redirect to two different pools based on URI. So far I have come up with the following with the iRule editor, but need to validate this will work as well as have a way of specifying a default pool:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*/us/*" { pool pool_us }
"*/uk/*" { pool pool_uk }
}
}
Does this look correct? How do I specify a default pool?
Thanks in advance!
- hoolio
Cirrostratus
That looks good. You can add a default case using the keyword default. If the string you're looking for is part of the path, you could replace HTTP::uri with HTTP::path. HTTP::path doesn't include the query string, so it might be more specific for your case.when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "*/us/*" { pool pool_us } "*/uk/*" { pool pool_uk } default { pool default_pool } } }
- Erik_Durand_277
Nimbostratus
Thanks Aaron - much appreciated!
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