本文介绍了从Nginx中的Set-Cookie标头登录值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从Cookie写入密钥'uuid'的nginx访问日志值以进行服务器响应(标题:Set-Cookie)?
Is it possible to write in nginx access log value of key 'uuid' from Cookie for server response (header: Set-Cookie)?
$ cookie_uuid-返回发送客户端的uuid $ sent_http_set_cookie-返回整个标头Set-Cookie:'uuid = 897587e7-a733-422f-9daa-b3105a5895aa; domain = domain;路径=/; expires = Tue,09-Aug-2033 01:17:54 GMT',但是我只需要保存键'uuid'的值
$cookie_uuid - return uuid that sent client $sent_http_set_cookie - return whole header Set-Cookie: 'uuid=897587e7-a733-422f-9daa-b3105a5895aa; domain=domain; path=/; expires=Tue, 09-Aug-2033 01:17:54 GMT', but I need save only value for key 'uuid'
谢谢
推荐答案map $sent_http_set_cookie $resp_uuid { ~*uuid=(?<u>[0-9a-f-]+) $u; }
参考:
- nginx/r/map
- 人pcresyntax
更多推荐
从Nginx中的Set
发布评论