Hi everyone,<div><br></div><div>I&#39;m attempting to implement a module which generates a &quot;request id (rid)&quot; variable. It&#39;s basically a uuid. The special requirement I have is that this variable (call it $request_id) needs to be different per-request, but also contain the same value if referenced multiple times in that request. For example, I will use the variable in both a log_format directive as well as a proxy_set_header directive. (Obviously the id is to log a request id that can be used to correlated frontend requests to activity/exceptions on the backends). So obviously I want to $request_id to be the same in log_format and proxy_set_header, but at the same time different for every request.</div>
<div><br></div><div>I have the basic functionality of the variable working, but what I can&#39;t figure out how to do is to keep the value the same during a single request. Right now every time $request_is used, by get_handler is invoked and i generated new uuid.</div>
<div><br></div><div>Is there some way of indicating the variable should be cached the request scope, or is there somewhere I can store the variable in ngx_http_request_t* for later retrieval?</div><div><br></div><div>I&#39;ll be releasing this project on github once I can complete this piece of the functionality.</div>
<div><br></div><div>Thanks,</div><div>Brian</div>