Forum Discussion
Joel_45259
Nimbostratus
Oct 03, 2007How to change active member in the pool without losing sessions?
Hello,
We have virtual server with 2 members in a pool where only other member at a time is active. When changing the active member, active sessions should still use the original member and the new connections go to the newly activated member. We change the active member by enabling and disabling them in the pool.
We are using the HTTP cookie insert as a persistence method and the cookie's name is LBSESSION. We have an iRule that removes the cookie at the logout:
when RULE_INIT {
set ::remove_lbsession 0
}
when HTTP_REQUEST {
if { [HTTP::uri] equals "/jsp/ssl/logout.jsp" } {
log "need to remove LBSESSION"
set ::remove_lbsession 1
}
}
when HTTP_RESPONSE {
if {$::remove_lbsession==1} {
log "Removing LBSESSION"
HTTP::cookie remove LBSESSION
HTTP::cookie insert name LBSESSION value "0" path "/"
HTTP::cookie expires LBSESSION 0 absolute
set ::remove_lbsession 0
}
}
The iRule works as planned and removes the cookie from the browser. Any way the big-ip do not respect that but continues to use the old member though it should select a new member, set LBSESSION cookie again and fire LB_SELECTED event at the next connection from the browser.
Does anyone have any ideas or solutions for our problem? We would appreciate some help on this.
Best regards,
Joel Mäkinen
- hoolio
Cirrostratus
You're using a global variable, ::remove_lbsession to track when to delete the cookie. Global variables are accessible for all requests, so this may lead to trampling of the value and unexpected results. I'd suggest first changing the rule to use a local variable. I wouldn't use the RULE_INIT event at all. You can set a local copy of the variable in the HTTP_REQUEST event using 'set remove_lbsession 0' and then update it to 1 if the request is for the logout page. - Joel_45259
Nimbostratus
Thanks for your quick reply! - hoolio
Cirrostratus
Hi Joel, - Joel_45259
Nimbostratus
uRule! - hoolio
Cirrostratus
Glad to hear it worked.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects