Forum Discussion
mpfeifer_63884
Nimbostratus
Nov 30, 2009cookie expire
Hi.
We'd like to change the expiration date of a Cookie when a client comes in with a certain Useragent-string.
Normally our users just get the default Cookie which expires after the session. ...
hoolio
Cirrostratus
Nov 30, 2009Hi Markus,
The cookie in the request only contains a name and value. The expiration property is set by the server (or LTM) in responses. If you want to modify the cookie's expiration time, you'd need to check for the cookie in the response. You could do something like this:
when HTTP_REQUEST {
Check the User-Agent string
if { [string tolower [HTTP::header User-Agent]] contains "leo" } {
Set a variable to check the cookie in the response
set check_cookie 1
} else {
Set a variable to check the cookie in the response
set check_cookie 0
}
}
when HTTP_RESPONSE {
Check if cookie exists
if { $check_cookie && [HTTP::cookie exists "Cookiename_Test"]}{
Update cookie expiry time
HTTP::cookie expires Cookiename_Test 18144000
}
}
If that doesn't work as you expect, try adding logging of the requests/user-agents/cookies in the request and response. You could also use a browser plugin like HttpFox for Firefox or Fiddler for IE to see which cookies are being set/received.
Aaron
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
