0
Ниже код отлично работает в Openresty LuaУдаление нескольких динамически с именем куки в Openresty Lua
ngx.header["Set-Cookie"] = {
'test1=; expires=Thu, Jan 01 1970 00:00:00 UTC; domain=test.com;',
'test2=; expires=Thu, Jan 01 1970 00:00:00 UTC; domain=test.com;'
}
хотя при попытке сделать имена печенья динамична, она не работает:
local cookies = {}
local args = {'test1', 'test2'}
for i=1, #args do
cookies[i] = args[i] .. '=; expires=Thu, Jan 01 1970 00:00:00 UTC; domain=test.com;'
end
ngx.header["Set-Cookie"] = cookies
есть даже попытался с помощью table.insert:
local cookies = {}
local args = {'test1', 'test2'}
for i=1, #args do
table.insert(cookies, args[i] .. '=; expires=Thu, Jan 01 1970 00:00:00 UTC; domain=test.com;')
end
ngx.header["Set-Cookie"] = cookies
Издание кажется с присвоением переменной в ngx.header["Set-Cookie"]