Forum Discussion
Cookie Persistence (iRule) Reset Timeout
We have a virtual, with several pools defined in it's iRule. The application owner has the application timeout users in 60 minutes of no activity. They've requested that the load balancer do the same, time out idle sessions after 60 minutes.
Our iRule times out users at 60 minutes of activity or no activity. Is there a way to either resend the cookie with a new timeout or reset the expire time of the existing cookie on the client?
Below is a sample of our iRule
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
“/example*”
{
pool VIPNAME1-POOLNAME
persist cookie insert cookie "0d 00:60:00"
}
“/sample*”
{
pool pool VIPNAME-POOLNAME
persist cookie insert cookie "0d 00:60:00"
}
}
}
Thanks MJ
3 Replies
- IheartF5_45022
Nacreous
So normally the cookie is inserted in only 1 response - you need the cookie inserted in every response so that it always expires in 60min. Let me know if this works;-
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { “/example*” { pool VIPNAME1-POOLNAME } “/sample*” { pool pool VIPNAME-POOLNAME } } persist cookie insert cookie "0d 00:60:00" set cname "BIGipServer[LB::server pool]" if {[HTTP::cookie exists "BIGipServer[LB::server pool]"} { Save the current cookie value set cvalue [HTTP::cookie $cname] } } when HTTP_RESPONSE { if {![HTTP::cookie exists $cname]} { If there is no cookie in this response already, insert one HTTP::header insert Set-Cookie "$cname=$cvalue; Path=/; Max-Age=3600; HttpOnly } } - Mohamed_Lrhazi
Altocumulus
Check your cookie persistence profile, recent versions have the option to enable this feature there.
- IheartF5_45022
Nacreous
Ah yes thanks Mohammed - it seems this is default behaviour in 11.6 onwards.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
