Forum Discussion
tkarni_92568
Apr 29, 2008Historic F5 Account
Cookie persistence with path attribute
Hi,
The need is to use persistence only for URLs under the "/login/" directory.
All other requests should be load balanced (OneConnect is enabled on the VS).
The chosen method is cookie.
I think the best way could have been to use "persist cookie insert" with a path attribue in the HTTP_REQUEST event to match "/login". But since there is no path attribute, I achieved the goal in a different way (see below).
But now the iRule works on the response as well and adds more work in the overall.
Is there a better way to achieve this, more efficient?
Thanks in advance!
Tom.
when HTTP_REQUEST
{
This is the cookie name used for persistence in the response
set persistence_cookie_name "bigippi"
Get the first 7 characters of the URI
set seven_chars_uri [string range [HTTP::uri] 0 6]
Check if the first 7 characters of the URI equal "/login"
if {[string tolower $seven_chars_uri] eq "/login/"}
{
There is a match so set a persistence cookie in the response
persist cookie insert $persistence_cookie_name
}
else
{
There is no match so use no persistence cookie
persist none
}
}
when HTTP_RESPONSE
{
Check if the resposne contains the persistence cookie
if {[HTTP::cookie exists $persistence_cookie_name]}
{
Set the persistence cookie path to the first 7 characters of the URI
HTTP::cookie path $persistence_cookie_name $seven_chars_uri
}
}
2 Replies
- The_Bhattman
Nimbostratus
Did you take a look at these 2 links - tkarni_92568Historic F5 AccountThanks Colin.
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