Forum Discussion
Type11_8030
Nimbostratus
Mar 21, 2011Persistance Rule based on Query String
I am a Cisco ASA guy who now as some f5s to manage (they rock btw). One thing I need to migrate almost immediately and don't have time to figure out everything about IRule (tcl) syntax is to do a persistance rule based on an irule (at least I assume this is what I want) that looks in the http get query params for stickiness. We are using a kind of proxy so I can't get the source Ip from the header like normal. A small get looks like
GET /rightsmanager/service?ver=1.0&m=--eftamv&sname=RIGHTSINFOINT&huid=MAC_NOT_IMPLEMENTED&scmd=query&maxkeylen=1279&sourceIP=10.7.1.199&sn=vzw HTTP/1.1
sourceIP is the variable I want to use for persistance. thanks in advance for any help on this. I will learn more about iRule syntax just up against the wall on this one
6 Replies
- Steve_Brown_882Historic F5 AccountThis should actually be fairly easy. Really all you need to do is set a variable to the value of this Query String param and then use the var for universal persistence. I found another thread that did something similar and modified hoolio's response form there.
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1171677/showtab/groupforums/Default.aspx
Check if query string parameter named Source IP has a value
http://devcentral.f5.com/wiki/default.aspx/iRules/uri__query
set sourceIP [URI::query "?&[HTTP::query] &sourceIP]
if {$sourceIP ne ""}{
Persist off of the source IP value
persist uie $sourceIP
}
}
Once the irule is created you simply create a universal persistence profile and point to this irule. Apply that to you VS and viola... - Nice!
If you run into any issues with that, and have the ability to insert the XFF header at the proxy device, you can always persist off of that. An example is in Hoolios post Steve referenced. - Type11_8030
Nimbostratus
So first off thanks so much for the unreal quick response! You guys are great. I assume with a rule like that if the request did not have the sourceip (there is a chance first time it comes in it will not) it will just fall into the normal balancing method (round robin in my case)? Thanks again! - Steve_Brown_882Historic F5 AccountYes, if no existing persistence record exists it will be load balanced using the method defined in your pool.
- Type11_8030
Nimbostratus
Thanks so much guys you rule. - Colin_Walker_12Historic F5 AccountYou guys rock, keep it up and thanks! ;)
Colin
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