Forum Discussion

robert_83958's avatar
robert_83958
Icon for Nimbostratus rankNimbostratus
Nov 04, 2011

Unclear about persistence via irule

Hi, below the following irule. 1 website is split across 2 webservers. this is because everything under the uri /zorg or /zorgverzekering runs on seperate servers.

 

 

 

Also, from this seperate part of the website, it calls on scripts which have the same url as a part of the other website.

 

e.g.: http://www.app.nl/resources/script.js

 

exists for the 2 applications, but differ in content. In order to tackle this problem, i check for the http-referer.

 

 

 

How do i manage persistence across the 2 pools?

 

The F5 documentation is not very clear about this. I also found references i should be able to use a persistence profile, but this doesn not work from an irule.

 

 

 

I think it should be like this:

 

 

 

persist cookie insert "Desired_cookiename" "0d 00:45:00"

 

pool Application_pool_name

 

 

 

 

 

 

It inserts a cookie, but it looks like it does this for every request.

 

What is the best way to approach this?

 

 

 

 

 

 

 

The irule:

 

 

 

when HTTP_REQUEST {

 

 

 

switch -regexp [string tolower [HTTP::uri]] {

 

 

 

"^.*zorgverzekering/(.*)" -

 

"^zorg/(.*)" -

 

"^.*zorg/(.*)" -

 

"^zorgverzekering/(.*)" {

 

persist cookie insert "Cookie_Zorg" "0d 00:45:00"

 

pool App_pool_zorg }

 

"^.*app_themes/(.*)" -

 

"^.*resources/(.*)" -

 

"^.*handlers/(.*)" -

 

"^.*scriptresource\.axd(.*)" -

 

"^.*webresource\.axd(.*)" { if {[HTTP::header value Referer] contains "/zorgverzekering/" } {

 

persist cookie insert "Cookie_Zorg" "0d 00:45:00"

 

pool App_pool_zorg

 

}

 

else {

 

persist cookie insert "Cookie_Schade" "0d 00:45:00"

 

pool App_pool_schade

 

}

 

}

 

"^(.+)" { if {[HTTP::header value Referer] matches_regex "^.*zorgverzekering\.css(.*)" } {

 

persist cookie insert "Cookie_Zorg" "0d 00:45:00"

 

pool App_pool_zorg

 

}

 

}

 

Default {

 

persist cookie insert "Cookie_Schade" "0d 00:45:00"

 

pool Ditzo_pool_schade

 

}

 

}

 

}

 

 

 

2 Replies

  • The KB's will help you ,

     

     

    http://support.f5.com/kb/en-us/solutions/public/9000/800/sol9815.html

     

     

    http://support.f5.com/kb/en-us/solutions/public/7000/900/sol7964.html

     

     

    You can also look at a similar question I asked in this community

     

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/2156795/showtab/groupforums/Default.aspx2232208

     

     

    good luck
  • It would be significantly more efficient to replace the regexes with string patterns in the switch statement. You can check the string match man page for examples of the supported wildcards:

     

     

    http://www.tcl.tk/man/tcl8.4/TclCmd/string.htmM35

     

     

    Aaron