Input value from Set-Cookie header in nginx

Is it possible to write to the nginx log the value of the access log "uuid" from a cookie for a server response (header: Set-Cookie)?

$ cookie_uuid - returns the uuid that the client sent $ sent_http_set_cookie - returns the entire Set-Cookie header: 'uuid = 897587e7-a733-422f-9daa-b3105a5895aa; domain = domain.com; Path = /; expires = Tue, 09-Aug-2033 01:17:54 GMT ', but I only need to save the value for the key' uuid '

thank

+3
source share
1 answer
map $sent_http_set_cookie $resp_uuid {
    ~*uuid=(?<u>[0-9a-f-]+) $u;
}

Link:

+3
source

Source: https://habr.com/ru/post/1536664/


All Articles