用lua 对cookie的控制
时间:2015-06-07 11:14:13
收藏:0
阅读:4552
header_filter_by_lua ‘
t = {}
if ngx.var.http_cookie then
s = ngx.var.http_cookie
for k, v in string.gmatch(s, "(%w+)=([%w%/%.=_-]+)") do
t[k] = v
end
end
p = ngx.req.get_uri_args()
if not t.uid and p.uid then
expires = ngx.cookie_time(4523969511)
ngx.header["Set-Cookie"] = {"uid=" .. p.uid .."; expires=" .. expires .. ";
end
‘;
原文:http://my.oschina.net/epiclight/blog/425898
评论(0)