Forum Discussion
Tim_Abbott_4960
Nimbostratus
Jun 08, 2005New to iRules: Need persistance based on virutal directory
I am new to the iRules and I'm looking for a way to persist a virtual directory.
Here is my issue.
I have one website www.mysite.com but I have two applications on that website; www.mysite.com/app1 and www.mysite.com/app2. The app1 works fine with the load balancer. The app2 needs to have users persisted to the same web server during that session.
How do I configure an iRule to look for the uri of "app2" and turn persistence on? And what are the recommendations and the type of persistence I should use in this scenario (Simple, Cookie - Insert, rewrite, Passive, Hash -, Universal, etc..)
Thanks,
Tim
- Tim_Abbott_4960
Nimbostratus
OK, here is what I've come up with so far but I need some more help.rule sautooffice_uri { when HTTP_REQUEST { if { [HTTP::uri] starts_with "/sautooffice" } { persist cookie insert cdmao pool www.cdmdata.com } } virtual CDMDataProduction { destination 10.250.110.100:http ip protocol tcp profile http tcp pool www.cdmdata.com persist AppCookie rule sautooffice_uri }
- unRuleY_95363Historic F5 AccountActually, you are very close. Since you already have persistence enabled on the virtual, all you need to do in the rule is disable persistence for the urls you don't want it on. Try changing your rule like this:
rule sautooffice_uri { when HTTP_REQUEST { if { not ( [HTTP::uri] starts_with "/sautooffice" ) } { persist none } } }
- Tim_Abbott_4960
Nimbostratus
Is a uri case sensitive? - Sure is, If you want to cover all cases, you can use the TCL builtin "string tolower" command to put the uri in lower case before you compare
if { not ( [string tolower [HTTP::uri]] starts_with "/sautooffice" ) } {
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