Forum Discussion
Beard_126011
Nimbostratus
Jul 29, 2015Cookie Counting
Hi,
im looking for someone who could kindly point me in the right direction to produce an IRule that will:-
For each request count the number of cookies that exist in that request and log the followi...
Kevin_Stewart
Employee
Jul 29, 2015That presents a special problem with regard to HTTP as a stateless protocol. Since any single HTTP request is atomic and indistinguishable from any other request, you have to employ state mechanisms outside the original protocol specification to be able to correlate multiple HTTP requests. The absolute easiest option here is an HTTP cookie. You could set a cookie on first HTTP request and then look for it in subsequent requests.
when HTTP_REQUEST {
if { not ( [HTTP::cookie exists MySiteCookie] ) } {
set setcookie 1
log local0. "IP: [IP::client_addr], Cookies: [HTTP::cookie count], UA: [HTTP::header User-Agent]"
}
}
when HTTP_RESPONSE {
if { ( [info exists setcookie] ) and ( $setcookie == 1 ) } {
HTTP::cookie insert name MySiteCookie value 1 path "/"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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