Forum Discussion
jlindwall_19593
Nimbostratus
May 11, 2015Are iRule instances scoped to a request/response?
I have an iRule that sets a variable in HTTP_REQUEST. In HTTP_RESPONSE, I read that variable.
Is this going to work properly? What I am assuming (heh!) is that each request/response gets a unique ...
May 11, 2015
Just adding to Roberts answer. Like he said, the variables are unique per connection. With HTTP pipelining there can be multiple requests within a connection. To make sure that a variable is "reset" for each request you can use the unset command, or set it to something generic in the beginning of the rule, such as an empty string or 0.
In your rule the cnParamValue would be set each time the request is sent, and would not affect anything outside the connection it's in. If you want you could unset it in the HTTP_RESPONSE event.
when HTTP_REQUEST {
set cnParamValue $value
}
when HTTP_RESPONSE {
if { [info exists cnParamValue] and $cnParamValue ne "" } {
log local0. $cnParamvalue
unset cnParamValue
}
}
/Patrik
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