Forum Discussion

Helena_101649's avatar
Helena_101649
Icon for Nimbostratus rankNimbostratus
Jun 26, 2012

Cookie persistence profile and iRule question

Hello,

 

 

I have a Virtual Server with a default pool and a cookie persistence profile, method Cookie insert. I have also an iRule for the Virtual Server, which load balance to the default pool if some URIs are matched and to another pool it there's no match:

 

 

 

when HTTP_REQUEST {

 

switch -glob [HTTP::path] {

 

"/xxx/*" {

 

pool pool_default

 

}

 

"/yyy/*" {

 

pool pool_default

 

}

 

default {

 

pool pool_other

 

}

 

}

 

}

 

 

My question is: ¿Is the persitence profile used for all the pools or just for the default pool specified in the VS configuration?

 

 

Thank's a lot.
  • Hi Zoe,

     

     

    Persistence is set at the virtual server level unless you modify that with an iRule using the persist command. If you use the default cookie insert persistence profile it should work find with your iRule. See the links in this post for details:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=26650&ptarget=26656

     

     

    Make sure to test with a OneConnect profile enabled on the virtual server. If you're using serverside source address translation, you can use the default OneConnect profile with a /0 source mask. Else, use a custom OneConnect profile with a /32 source mask.

     

     

    Aaron
  • Thanks. I will try with OneConnect profile. Anyway, I 've realised that persitencie will not resolve my issue. What I want is to avoid the iRule execution once a pool member has been selected. I mean, I don't want the iRule beening processed for every object in the web page, or every page within the same session. But even it persistence is set and working ok, the iRule still executing on every GET/POST, isn't it?

     

    So, I think maybe a new condition looking fort he BIGip cookie at the beginning of the iRule will do the job:

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::cookie exists "BIGipServer"]} {

     

    return

     

    }

     

    }

     

     

    ¿Should that work?
  • when HTTP_REQUEST {

     

    if {[HTTP::cookie exists "BIGipServer"]} {

     

    return

     

    }

     

    } return command does not stop triggering another event.

     

     

    return wiki

     

    https://devcentral.f5.com/wiki/iRules.return.ashx

     

     

    for your question, have you seen this post? Aaron has provided sample irule there.

     

     

    Persistance in a I-rule

     

    https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/39/aft/2158969/showtab/groupforums/Default.aspx
  • It's true, I was wrong about the "return". I think that what I was looking for is more an "event disable all".

     

     

    I hadn't seen the post, I will try with somethink like the example, thank's a lot.
  • It's true, I was wrong about the "return". I think that what I was looking for is more an "event disable all".

     

     

    I hadn't seen the post, I will try with somethink like the example, thank's a lot.
  • I think that what I was looking for is more an "event disable all". event disable affects only current connection. i thought you want even new connection (one session may contain many connection) is sent to specific pool member after persistence record has been created.

     

     

    event wiki

     

    https://devcentral.f5.com/wiki/iRules.event.ashx