local function setCookies(cookieValue)
local val = cookieValue:lower()
if string.match(val, "expires") then
return nil
else
return cookieValue
end
end
local rh = ngx.resp.get_headers()
for k, v in pairs(rh) do
if k:lower() == "set-cookie" then
if (type(v) == "table") then
-- checks if there are multiple Set-Cookie Headers
for key, value in pairs(v) do
ngx.header["Set-Cookie"] = setCookies(value)
end
else
ngx.header["Set-Cookie"] = setCookies(v)
end
end
end
--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/53097b39-8b0a-457e-859a-801e1f27ab34n%40googlegroups.com.
local cookieHelper = require "resty.cookie"
local rh = ngx.resp.get_headers()
for k, v in pairs(rh) do
if k:lower() == "set-cookie" then
local cookie, err = cookieHelper:new()
if (type(v) == "table") then
-- checks if there are multiple Set-Cookie Headers
for key, value in pairs(v) do
if string.match(value, "expires") then
ngx.header["Set-Cookie"] = nil
else
cookie:set({key = value:match("([^=]+)"), value = value, path = "/"})
end
end
else
if string.match(v, "expires") then
ngx.header["Set-Cookie"] = nil
else
cookie:set({key = value:match("([^=]+)"), value = v, path = "/"})
end
end
end
end
On 2 Apr 2021, at 21:22, Kshitij Joshi <kshiti...@gmail.com> wrote:
ngx.header["Set-Cookie"] = nil
--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/09CA21FE-B7EB-45BB-B833-077F32DE67EA%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/56eab63c-f88d-4d26-8420-f5e7a64b2471n%40googlegroups.com.
COPY conf /usr/local/openresty/nginx/conf -> my .conf files
COPY lib/ /usr/local/openresty/lualib/ -> my internal lua files
COPY externals /usr/local/openresty/lualib/resty/ -> my external lua files (modules)
CMD ["/usr/bin/openresty", "-g", "daemon off;"]
local cookieHelper = require "resty.cookie"
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/ce135962-52e9-427e-afdb-cf5c95c49da9n%40googlegroups.com.