Forum Discussion
Tiago_Teixeira_
Nimbostratus
Nov 29, 2017Preserve old cookie expire Irule
Hi,
I have an Irule to remove old cookie and insert a new cookie and value. The dev team change the aplication and insert the expire age in old cookie. How I preserve this atribute in new cookie?
Fol...
Andy_McGrath
Cumulonimbus
Nov 29, 2017Based on your iRule need to add the expire but needs to be an additional command.
when HTTP_RESPONSE {
set cookies [HTTP::cookie names]
look for a persistence cookie being set
if { $cookies contains "JSESSIONID" } {
rewrites all cookies being
set foreach cookie_name $cookies {
set cookie_value [HTTP::cookie $cookie_name]
set cookie_expire [HTTP::cookie expires $cookie_name]
HTTP::cookie remove $cookie_name
HTTP::cookie insert name $cookie_name value $cookie_value domain ".mysite.com.ar" path "/" version 0
HTTP::cookie expires $cookie_name $cookie_expire absolute
}
}
}
However your iRule is replacing each cookie with the same cookie name and value, you can simple update the domain and path instead of remove and replace, this should not change the expires value set by the backend server:
when HTTP_RESPONSE {
set cookies [HTTP::cookie names]
look for a persistence cookie being set
if { $cookies contains "JSESSIONID" } {
rewrites all cookies being
set foreach cookie_name $cookies {
HTTP::cookie domain $cookie_name ".mysite.com.ar"
HTTP::cookie path $cookie_name "/"
}
}
}
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