Forum Discussion
Mahesh_56902
Nimbostratus
Mar 30, 2007Context between HTTP request and respose
Can I have context between HTTP request and response? In other words, if I set a variable in an iRule script in request event, can I access it in response event for that connection?
- Sure can. Variables without a namespace are automatically assigned to the current connection. So, as long as it's during the same connection, you can set variables in one event, and retrieve them from another.
when HTTP_REQUEST { set orig_uri [HTTP::uri] } when HTTP_RESPONSE { log local0. "Original URI: $orig_uri" }
- Mahesh_56902
Nimbostratus
Thanks Joe. - Sure can, but keep in mind that there are no build-in safeguards for overwriting the values across connections. Counters and totals are fine as they aren't connection specific. You could do something like this:
when RULE_INIT { set ::total_requests 0 } when HTTP_REQUEST { incr ::total_requests 1 }
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