Forum Discussion
mjohns2_184959
Cirrus
Oct 02, 2015Cookie 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...
IheartF5_45022
Nacreous
Oct 02, 2015So 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
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
