Forum Discussion
John_41578
Nimbostratus
Aug 31, 2009iRule that allows passing parameters
Hi,
Newbie here trying to figure things out. I have an iRule set as follows (condensed for brevity, actual paths removed for security):
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/foo" { pool content_pool }
"/foo/*" { pool content_pool }
default { pool pool_main_site }
}
}
What I want is for all requests for "/foo" and "/foo/*" to go to the content_pool while everything else goes to the main pool. I originally had "/foo*" but then "/foobar" was getting routed as well, which I didn't want. This rule works fine except for one problem: when parameters are passed to "/foo" the request goes to the default pool. For example...
This does not route to the content pool but should:
http://example.com/foo?i=1
These work as expected (route to content pool):
http://example.com/foo
http://example.com/foo/page
http://example.com/foo/page?i=1
Note that all pages may or may not have parameters passed, and these URIs should always route to the content pool regardless.
Also note that I have about 10 pages/paths that I need to do this with, not just foo. So also let me know if there's a cleaner, better, easier way to say "these 10 pages, plus everything under them, with or without parameters."
Thanks in advance,
John
- hoolio
Cirrostratus
Hi John,when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/foo"- "/foo/*" { pool content_pool } default { pool pool_main_site } } }
- John_41578
Nimbostratus
Thank you, Aaron. That worked perfectly! - hoolio
Cirrostratus
Good to hear.
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