Forum Discussion

Paul_Slosberg_8's avatar
Paul_Slosberg_8
Historic F5 Account
May 21, 2007

persistence sid and mobile devices

Greetings,

 

I have used the iRule that I found on devcentral with good success in my lab but when trying to use real data I ran into a stumbling block.

 

original code

 

 

 

 


when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "sid"] and $add_persist } {
persist add uie [HTTP::cookie "sid"]
set add_persist 0
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "sid"] } {
persist uie [HTTP::cookie "sid"]
} else {
set jsess [findstr [HTTP::uri] "sid" 4 "?"]
if { $jsess != "" } {
persist uie $jsess
}
}
}

 

 

This works until the mobile devices go through proxy and the cookie can be appended with data we do not need. I was hoping to find a good way to has the cookie data. This is what I came up with but its not working.

 

 


 when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "sid"] and $add_persist } {
persist add uie [findstr [HTTP::cookie] "sid" 4 ";"]
set add_persist 0
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "sid"] } {
persist uie [findstr [HTTP::cookie] "sid" 4 ";"]
} else {
set jsess [findstr [HTTP::uri] "sid" 4 "?"]
if { $jsess != "" } {
persist uie $jsess
}
}
}

 

 

this is an example of the appened value

 

 

Cookie: sid=fertLBH2OLMHXcfEjXukr; $Path="/"; name=SCDRb11663f0101aa83e; $Path="/";

 

 

 

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    When you say this isn't working, what do you mean exactly? Is the code throwing errors to the ltm log? Are you just not receiving the results you're expecting? Have you tried adding some logging?

     

     

    Thanks,

     

    Colin