Forum Discussion
fayar_128903
Nimbostratus
Jul 09, 2013Http cookies insertion in LTM
Hello !
I am currently learning how to write iRules. In order to implement a logging script on a LTM device (BigIp V11), I would like to insert a cookie containing a number in my http request. ...
Kevin_Stewart
Employee
Jul 11, 2013Just create an arbitrary variable in the HTTP_REQUEST event and look for it in the HTTP_RESPONSE event. Example:
when HTTP_REQUEST {
set GUID [format %09d [expr {int(rand() * 1e9)}]]
send something to logs...
}
when HTTP_RESPONSE {
if { [info exists GUID] } {
send something to logs...
unset GUID
optionally unset the variable
}
}
The most important thing is that you test for the existence of the variable in the response before trying to use it.
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