Forum Discussion

brad_11452's avatar
brad_11452
Icon for Nimbostratus rankNimbostratus
Mar 23, 2007

Persist on uri argument

I am new to irules and am trying to set up persistence based on an argument passed in the uri. Here is a sample:

 

 

http://mydomain.com/test.jsp?clientIp=10.1.1.47

 

 

So I want to persist on 10.1.1.47

 

 

Here is what I have so far:

 

 

when HTTP_REQUEST {

 

set host [HTTP::host]

 

set uri [HTTP::uri]

 

set path [URI::path [HTTP::uri]]

 

set query [URI::query [HTTP::uri]]

 

set ip [URI::query [HTTP::uri] "clientIp"]

 

persist uie $ip

 

}

 

 

I can see records in the persistence tables that contain the IP address but persistence does not seem to be entirely working.

 

 

Any thoughts or help would be greatly appreciated.

 

 

Thanks
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    I think you can simplify your rule a little.

    Try something like:

    
    when HTTP_REQUEST {
      persist uie [URI::query [HTTP::uri]]
    }

    All you're looking to accomplish is to set a unique token that will only change when the clientIP value changes. This should be a simple way of doing so.

    Colin
  • Thanks Colin, that does the trick in my quick little tests!

     

     

    Brad