On Fri, Jan 27, 2017 at 10:24 PM, Patrick Hemmer
<[email protected]> wrote:
> Something that might satisfy both requests, why not just append to the
> existing request-id?
>
>     unique-id-format %[req.hdr(X-Request-ID)],%{+X}o\
> %ci:%cp_%fi:%fp_%Ts_%rt:%pid
>
> This does result in a leading comma if X-Request-ID is unset. If that's
> unpleasant, you could do something like write tiny LUA sample converter to
> append a comma if the value is not empty.


However, just setting the `unique-id-format` is not enough, as we
should also send that ID to the backend, thus there is a need of
`http-request set-header X-Request-Id %[unique-id] if !...`.  (By not
using the `http-request`, we do get the ID from the header in the log,
but not to the backend.)

But now -- I can't say with certainty, but I remember trying various
variants -- I think the evaluation order of `unique-id-format` is
after all the `http-request` rules, thus the header will always be
empty (if not explicitly set in the request), although in the log we
would have a correct ID.


(This is why I settled with a less optimal solution of having two
headers, but with identical values, and working correctly in all
instances.)

Ciprian.

Reply via email to