Forum Discussion

Paul_97278's avatar
Paul_97278
Icon for Nimbostratus rankNimbostratus
Mar 29, 2010

Compare cookie last accessed date?

“Can the F5 compare the value of HTTP header If-modified-since (or any other header), to the value of a cookie?”

 

 

The F5 should be able to detect that the value of cookie “LastAccessed” comes before the “If-Modified-Since” header and therefore return an HTTP 304 Not modified…

 

 

Possible? Any suggestions how this could be done?

 

 

So, for example, for HTTP request like

 

 

GET /catalog/4A/4A92C8CA20DB014BE10080002BC29BDF.gif HTTP/1.0

 

Accept: */*

 

Referer: https://www.testsite.de/testsite/b2c/start/(xcm=PCM_b2ccrmstandard)/.do;jsessionid=(J2EE244165100)ID1159571750DB01780867448243448253End;saplb_*=(J2EE244165100)244165150

 

Accept-Language: en-gb

 

Cookie: LastAccessed= Fri, 26 Mar 2010 19:43:31 GMT; TLTSID=C0A8CB5000000127AA1C190500007BA2; TLTUID=C0A8CB5000000127AA1C190500007BA3; saplb_*=(J2EE244165100)244165150; rl-sticky-key=c1e9e4377495b386cedc0a93bebea8c1; JSESSIONID=(J2EE244165100)ID1159571750DB01780867448243448253End; s_cc=true; gpv_p15=sss%20%3A%20Home; s_sq=%5B%5BB%5D%5D

 

If-Modified-Since: Sat, 27 Mar 2010 14:57:34 GMT; length=5202

 

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6.4; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)

 

Host: www.testsite.de

 

Connection: Keep-Alive

 

 

 

1 Reply

  • Hi Paul,

     

     

    Is that an actual example request? If so, does the client actually send a cookie with a name of LastAccessed? The cookie looks a bit odd, as spaces should be percent encoded per the HTTP RFC's.

     

     

    Anyhow, you could use HTTP::cookie (Click here) to parse the cookie value, HTTP::header (Click here) to get the If-Modified-Since header value, getfield (Click here) to parse up to the semi-colon, clock scan (Click here) to convert the two timestamps to unix time and then expr (Click here) compare the two. You can use HTTP::respond (Click here) to send a 304 response.

     

     

    Aaron