ngx_lua库的set-cookie问题

51 views
Skip to first unread message

HN Z (Ne)

unread,
Sep 20, 2023, 10:22:59 PM9/20/23
to openresty
使用中发现,无论是使用ngx.header['Set-Cookie']方法还是ngx.header.set_cookie方式来setcookie,仅最后一次set生效。对于比较复杂的请求处理,需要在不同阶段决定是否set cookie时,有没有可行方案呢?

along

unread,
Feb 3, 2024, 11:07:59 PMFeb 3
to openresty
https://github.com/cloudflare/lua-resty-cookie 可以看下,这个是不是可以满足你的需求

Junlong li

unread,
Feb 4, 2024, 5:42:13 AMFeb 4
to openresty
对于 cookies,你应该用 GET MODIFY SET这样的方式。而不是直接 SET 

On Sunday, February 4, 2024 at 12:07:59 PM UTC+8 along wrote:
https://github.com/cloudflare/lua-resty-cookie 可以看下,这个是不是可以满足你的需求

Reply all
Reply to author
Forward
0 new messages