Add set_secure_random_hex
Create a random hexadecimal string. Very useful for making trace-ids in X-B3-* headers for zipkin.
@ckiickA Have you looked at the existing set_secure_random_* directives?
See https://github.com/openresty/set-misc-nginx-module#set_secure_random_alphanum for example.
I have. However, there's no way to restrict the string generated to just hex digits. The Zipkin spec says traceid's are random hexadecimal 64 bit numbers. I attempted to use get_random and hex_encode, but hex_encode just gives the ascii codes of the digits.
@ckiickA Hmm, maybe you should use the ngx_lua module for such special requirements instead. Otherwise this simple ngx_set_misc module would keep growing forever, which is a bad thing IMHO :)
Not an option for our environment. I can use a custom patch for now. Just thought you might find it useful. Producing a random hex string doesn't seem that much of a special requirement to me. I was surprised that none of the existing modules could do it. Anyway, do what you want with the PR. Just trying to give back.
On Mon, Nov 23, 2015 at 9:29 AM, Yichun Zhang [email protected] wrote:
@ckiickA https://github.com/ckiickA Hmm, maybe you should use the ngx_lua module for such special requirements instead. Otherwise this simple ngx_set_misc module would keep growing forever, which is a bad thing IMHO :)
— Reply to this email directly or view it on GitHub https://github.com/openresty/set-misc-nginx-module/pull/28#issuecomment-158969256 .
Chris J. Kiick Senior Performance Engineer, Atlassian [email protected]