从Nginx中的Set-Cookie标头登录值 [英] Log in value from Set-Cookie header in nginx

查看:1640
本文介绍了从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.com;路径=/; 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.com; 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中的Set-Cookie标头登录值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆