Forum Discussion

kunalPatel_3157's avatar
Oct 25, 2018

Persistence through IRULE

I have following irule:

when HTTP_REQUEST {

if {([HTTP::uri] contains "Communication") or ([HTTP::uri] contains "Builder") } {

       persist cookie
       pool XYZ
}


elseif { ([HTTP::uri] contains  "PDFTemp") or ([HTTP::uri] contains  "DOCTemp") }
{ 

         persist none
         pool ABC
}

}

But I am still seeing Persistence on second pool ABC and I had to put the Persistence method cookie on Virtual servers Resources, Default Persistence Profile Section.

If I don't put that on the Virtual server, it gives an error that irule is using Persistence method so VS needs to have "cookie" in VS > Resources > Default Persistence Profile Section : "Cookie"

3 Replies

  • I'm not clear on what issue you are facing. Do you want to have persistence on connections forwarded to pool ABC but are not seeing it, or do you want to not have persistence on pool ABC, but are seeing it?

     

    Regarding the need for the cookie persistence profile on the virtual server, cookie, msrdp and ssl persistence all require the related persistence profile, per the 'persist' command page

     

  • First your

    persist cookie
    command is incomplete so to remove the need for the the Persistence profile on the virtual server (see the wiki iRule wiki: persist).

    So should be the following:

    persist cookie insert  
    

    e.g.

    persist cookie insert f5Cookie 0
    

    Second I would put the

    pool
    selection command before the persist, not sure if you need to do this but always done it my self and more examples show this to be done, e.g.:

    if {([HTTP::uri] contains "Communication") or ([HTTP::uri] contains "Builder") } {
        pool XYZ
        persist cookie insert f5Cookie 0
    } elseif {([HTTP::uri] contains "PDFTemp") or ([HTTP::uri] contains "DOCTemp")} { 
        pool ABC
        persist none     
    }
    

    Finally if you want to make sure you are enforcing the pool and persistence selection on every HTTP request I would attach a OneConnect profile to the virtual server K7208: Overview of the OneConnect profile if you don't already have one.