实例
ngx.header["Set-Cookie"] = {
"userId=" .. userId .. "; Max-Age=7200 ; Path=/; HttpOnly",
"orgId=" .. orgId .. "; Max-Age=7200 ; Path=/; HttpOnly"
}
遍历cookie
header_filter_by_lua '
local cookies = ngx.header.set_cookie
if cookies then
if type(cookies) == "table" then
for k,v in pairs(cookies) do
ngx.log(ngx.INFO,"k:"..k..",value:"..v)
end
else
ngx.log(ngx.INFO,"cookie:"..cookies)
end
end
';