Forum Discussion

Gregor_33926's avatar
Gregor_33926
Icon for Nimbostratus rankNimbostratus
Mar 03, 2009

Refresh a cookie expiration

Hi

 

I was wondering if anyone could help me with an irule.

 

I have a number of checks it does but one part is basically, if a user hasn't got a cookie and the maximum limit isn't reached, give them a cookie with X min expiration and let them through. If they have a cookie let them through no matter what. When the X mins expires the users session timeout. Which is what i initially wanted, now though if a user refreshes a page i want the expiration time to basically reset.

 

 

Curently I have this

 

 

when HTTP_RESPONSE {

 

If cookie didn't exist give a cookie with timeout of 5 mins

 

if {$need_cookie == 1}{

 

HTTP::cookie insert name "ticketcookie" value "ticketcookie"

 

HTTP::cookie expires "ticketcookie" "300" relative

 

HTTP::cookie path "/"

 

HTTP::cookie domain ".example.co.uk"

 

if {$::debug}{ log local0. "Sending cookie to [IP::client_addr]"}

 

}

 

}

 

And thought of just doing something like this....

 

 

when HTTP_RESPONSE {

 

If cookie didn't exist give a cookie with timeout of 5 mins

 

if {$need_cookie == 1}{

 

HTTP::cookie insert name "ticketcookie" value "ticketcookie"

 

HTTP::cookie expires "ticketcookie" "300" relative

 

HTTP::cookie path "/"

 

HTTP::cookie domain ".example.co.uk"

 

if {$::debug}{ log local0. "Sending cookie to [IP::client_addr]"}

 

} elseif {$need_cookie == 0} {

 

HTTP::cookie expires "ticketcookie" "180" relative

 

}

 

}

 

 

is there a reset command i am unaware of i could use. does the modification look like it'll work.
No RepliesBe the first to reply