Variables: Socket cookie variable for debugging purposes
Donatas Abraitis
donatas.abraitis at gmail.com
Tue Jul 11 19:18:00 UTC 2017
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`.
* Another example could be to use some other fancy stuff like load
balancing (hashing) by $socket_cookie.
At the moment at 000webhost.com we are using $request_id to identify
requests for clients, but $socket_cookie would be helpful too.
On Tue, Jul 11, 2017 at 6:20 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> Hello!
>
> On Fri, Jul 07, 2017 at 10:28:42PM +0300, Donatas Abraitis wrote:
>
>> this looks promising when new 4.12 kernel introduced SO_COOKIE socket
>> option which is able to generate a cookie for the socket.
>>
>> More information and implementation is here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5daab9db7b65df87da26fd8cfa695fb9546a1ddb
>>
>> Waiting for comments.
>>
>> # HG changeset patch
>> # User Donatas Abraitis <donatas.abraitis at gmail.com>
>> # Date 1499424023 -10800
>> # Fri Jul 07 13:40:23 2017 +0300
>> # Node ID 55b401978df27f1a1ab4eee4e50615b7551e3c0b
>> # Parent 70e65bf8dfd7a8d39aae8ac3a209d426e6947735
>> Add new `socket_cookie` variable
>>
>> This would be useful for tracking connections by cookie, not only by
>> request_id as we have it right now. Related:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5daab9db7b65df87da26fd8cfa695fb9546a1ddb
>
> It is not clear if such a variable is indeed beneficial, and how
> it can be used. Shouldn't client's address with port be good
> enough to identify a connection, at least in most practical cases?
>
> If you think it worth adding, please elaborate a bit more on how
> it is expected to be used.
>
> Alternatively, consider providing a module which exposes the
> variable, it should be trivial to implement.
>
> [...]
>
> --
> Maxim Dounin
> http://nginx.org/
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
--
Donatas
More information about the nginx-devel
mailing list