Variables: Socket cookie variable for debugging purposes

Maxim Dounin mdounin at
Tue Jul 11 19:58:26 UTC 2017


On Tue, Jul 11, 2017 at 10:18:00PM +0300, Donatas Abraitis wrote:

> In short, it provides unique socket identifier.
> * It would be simpler to identify connections and filter them out by
> $socket_cookie only. As an example could be a custom response header
> `X-Request: $socket_cookie:$request_id`, or just `X-Socket-Id:
> $socket_cookie`.

So how do you expect to use it?  And why you need $socket_cookie 
if there is $request_id and/or $connection?

> * Another example could be to use some other fancy stuff like load
> balancing (hashing) by $socket_cookie.

I see no difference with using $connection, $request_id, or any 
other number.  If you think there is a difference, please 

> At the moment at we are using $request_id to identify
> requests for clients, but $socket_cookie would be helpful too.

Note that $socket_cookie cannot be used to identify requests, it 
can only be used to identify connections.  There may be multiple 
requests in a connection.

Overral, it is still not clear if proposed variable is beneficial 
and how it is expected to be used.  If you think it is useful, 
consider writing a module which provides the variable.

Maxim Dounin

More information about the nginx-devel mailing list