Forum Discussion
Angel_Martinez_
Nimbostratus
Sep 18, 2009iRules, persistences, persistence profiles.
Hi
I've some doubts... I'll try to explain myself so apologizes for my English...
- Could anyone give me the differences between using: "session add uie $MyCookie 100" vs "persist uie $MyCookie 100", please ¿?
- I would like to use persistence with cookies from an iRule, should I manage this iRule as a persistence profile or just like a normal iRule...
- Is a good practice using a profile persistence "cookie in mode insert" and using iRules as a resource (with this situation I don't have to put Set-Cookie at the first HTTP_RESPONSE event).
FYI: (is an example in lab environment... I should reduce the memory impact etc..).
when HTTP_REQUEST {
set SwSetCookie 0
if { [HTTP::cookie "MyCookie"] != ""} {
set Cookie [HTTP::cookie "MyCookie"]
persist uie $Cookie 100
log local0.alert "Valor de la Cookie: $Cookie"
} else {
log local0.alert "No tengo Cookie activo el SW de Set-Cookie"
set SwSetCookie 1
}
pool MyPool
}
when HTTP_RESPONSE {
if { [HTTP::header Set-Cookie] starts_with "MyCookie" } {
set NuevaCookie [getfield [getfield [HTTP::header Set-Cookie] "=" 2] ";" 1]
log local0.alert "Add Persistencia Cookie: $NuevaCookie contra $MyServer"
persist add uie $NuevaCookie 100
}
}
when SERVER_CONNECTED {
if { $SwSetCookie == "1" } {
set MyServer [IP::server_addr]
log local0.alert "Primera conexion contra el servidor: [IP::server_addr]"
}
}
- hoolio
Cirrostratus
The easiest and most efficient way to ensure clients are persisted to the same pool member over the duration of a session is to use cookie insert persistence using the profile. This works well, is simple to configure and is more efficient than trying to mimic the functionality in an iRule. - Angel_Martinez_
Nimbostratus
Hi 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