Forum Discussion

sgoodliff_83611's avatar
sgoodliff_83611
Icon for Nimbostratus rankNimbostratus
Jan 18, 2008

cookie based connection limits

 

Hello,

 

 

I've been playing with this irule which is meant to set a cookie per client. But I'm using firefox and it sets 4 cookies. one per http request, Is there any way for it to be a bit cleverer and only set one cookie per client. I was thinking about checking if it is a keep alive request and seeing if that helped.

 

 

 

Any suggestions ?

 

 

Thanks

 

 

http://devcentral.f5.com/wiki/default.aspx/iRules/HTTPSessionLimit.html

 

4 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    You might try making a small addition to the HTTP_RESPONSE stanza.

     

     

    
      when HTTP_RESPONSE {
       ; insert cookie if needed
       if {$need_cookie == 1} {
         HTTP::cookie insert name "ClientID" value $client_id
         set need_cookie 0
       }
      }

     

     

    This is the only way I can really think that there would be multiple cookies inserted. The code looks good other than that.

     

     

    Colin
  • Hello,

     

     

    I've got it sorted.

     

     

    swap:

     

    HTTP::cookie insert name "ClientID" value $client_id

     

     

    For this:

     

    HTTP::cookie insert name "ClientID" value $client_id path "/"

     

     

     

    And now it works much better.

     

     

    Thanks
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Excellent catch, I've updated the codeshare sample.

     

     

    thanks!

     

    /deb
  • Out of curiosity, why would setting the path to / make a difference? I would have assumed that if the path is not set it would default to any path (ie, /).

     

     

    Aaron