Forum Discussion
Terry_Luedtke_1
Nimbostratus
Sep 08, 2009Persistence by pool rather than VIP?
Hi,
Is it possible to set persistence by pool rather than by VIP? For example, if we had an iRule like the following:
when HTTP_REQUEST {
switch [HTTP::path] {
"*.jpg" -
"*.gif" -
"*.png" { pool image_pool }
"*.asp" { pool dynamic_pool }
default { pool web_pool }
}
}
How would we set connections to the dynamic pool to be persistent, but connections to the image and web pools run free? I'm experimenting with setting up two VIPS and using "virtual dynamic_vip" to forward to another VIP with persistence turned on, though that seems overly complicated.
- Terry Luedtke
4 Replies
- The_Bhattman
Nimbostratus
Hi Terry,
You could invoke persistence on specific pool selectionswhen HTTP_REQUEST { switch -glob [HTTP::path] { "*.jpg" - "*.gif" - "*.png" { pool image_pool persist none } "*.asp" { pool dynamic_pool persist source_addr 255.255.255.255 30 } default { pool web_pool persist none } } }
Click here to learn more about the persist command.
Thanks,
CB - hoolio
Cirrostratus
Minor suggestions: if you want to use wildcards with switch, you need to use the -glob flag. And if it's an IIS based app, the objects aren't case sensitive. So you could set the path to lower case:
switch -glob [string tolower [HTTP::path]] { - Terry_Luedtke_1
Nimbostratus
Thanks, the persist command took care of it. I had seen that command, but got the impression it would obliterate any existing persistence associated with the VIP (and therefore the dynamic pool).
By the way, the iRule code in my post was just an example I copied from an article on the site that demonstrated my need. My iRule, unfortunately, is more complicated.
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=244
and
http://devcentral.f5.com/wiki/default.aspx/iRules/PoolBasedOnExtension.html
are both missing the -glob flag.
- Terry - hoolio
Cirrostratus
Hi Terry,
I edited the Codeshare example. You could try posting a comment on the article to fix the one example which uses wildcards without the -glob flag.
Thanks,
Aaron
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