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
}
}
}