Forum Discussion

commsmonkey_172's avatar
commsmonkey_172
Icon for Nimbostratus rankNimbostratus
Aug 08, 2010

Persist uie with Findstr query

I've come across the following irule and I'm not sure exactly what it's intentions are

 

 

rule Persist_Universal {

 

when HTTP_REQUEST {

 

persist uie [ findstr [HTTP::uri] "?" 9 3 ]

 

}

 

}

 

 

To me based on findstr this matches nearly everything heading by this node, eg most urls are as per the following http://somesite.com/content.html?query123ADF90

 

 

Cheers,

 

 

Comms

 

7 Replies

  • Hi Comms.

     

    Basically it's persisting based on the URI of a URL - specifically a query. 9 indicates what is skipped and 3 is the terminator. You can also use [HTTP::query] instead of [HTTP::uri] to accomplish this

     

     

    Bhattman
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Keep in mind we have HTTP::query and URI::query for accessing just the query portion of a URI as well. These would allow you to skip the findstr portion.

     

     

    Colin

     

  • according above , does it mean : startwith "q" , then skips 9 characters to" A ", and use 3 characters " DF9 " to persist session ? thank you !
  • e.g.

    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when RULE_INIT {
       set uri "/content.html?query123ADF90"
       log local0. "\[findstr $uri ? 9 3\] is [findstr $uri ? 9 3]"
    }
    }
    
    [root@ve10:Active] config  tail /var/log/ltm
    Sep  3 17:51:53 local/tmm info tmm[4925]: Rule myrule : [findstr /content.html?query123ADF90 ? 9 3] is ADF
    
    
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    yxshybj

     

     

    For http://somesite.com/content.html?query123ADF90 the persistence record (I believe) will be simply AD

     

     

    My logic: find ? in the URI, skip 9 chars to after the 3 and return the sub-string from there to the end, minus the terminator of length 3. So this is AD

     

     

    I'm sure if I'm wrong the most excellent community will correct me.

     

     

    Hope this helps.

     

    N

     

     

     

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Thanks nitass - looks like I was wrong. I did wonder if I should get on my test box to check...hence the delay in clicking on Submit and missing your post.

     

     

    N
  • hi,

     

    thanks very much .may i understand below : when skip 9 chars , it include the "?" ,so it start with the "?" , and end with "3"-------so the 9 chars are "?query123", and then use the after 3 chars "ADF" to persist the session, does this true ? thank you !