Forum Discussion

Type11_8030's avatar
Icon for Nimbostratus rankNimbostratus
Mar 21, 2011

Persistance 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= 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_882's avatar
    Historic F5 Account
    This 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.







    Check if query string parameter named Source IP has a value



    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.
  • 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_882's avatar
    Historic F5 Account
    Yes, if no existing persistence record exists it will be load balanced using the method defined in your pool.