系统相关
首页 > 系统相关> > 从Nginx中的Set-Cookie标头登录值

从Nginx中的Set-Cookie标头登录值

作者:互联网

是否可以从Cookie写入密钥’uuid’的nginx访问日志值以进行服务器响应(标题:Set-Cookie)?

$cookie_uuid-返回发送客户端的uuid
$sent_http_set_cookie-返回整个标头Set-Cookie:’uuid = 897587e7-a733-422f-9daa-b3105a5895aa; domain = domain.com;路径= /; expires = Tue,09-Aug-2033 01:17:54 GMT’,但我只需要保存键’uuid’的值

谢谢

解决方法:

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

参考:

> http://nginx.org/r/map
>人pcresyntax

标签:setcookie,nginx,access-log
来源: https://codeday.me/bug/20191122/2063593.html