在nginx中从Set-Cookie头部获取登录值

3
有没有可能在nginx访问日志中写入来自Cookie的key'uuid'的值用于服务器响应(标题:Set-Cookie)? $cookie_uuid - 返回发送客户端的uuid $sent_http_set_cookie - 返回整个标题Set-Cookie:'uuid = 897587e7-a733-422f-9daa-b3105a5895aa;domain = domain.com;path = /;expires = Tue,09-Aug-2033 01:17:54 GMT',但我仅需要保存键“ uuid ”的值
谢谢
1个回答

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

参考资料:


一个注释:~*uuid=(?<u>0-9a-f-)+ $u; 对我不起作用,但是 ~*uuid=(?<u>[0-9a-f-]+) $u; 正确工作。 - Alexey

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接