-
Notifications
You must be signed in to change notification settings - Fork 120
Description
Hello,
I put code snippet in access_by_lua_block, but session seems work properly, but sometimes not working.
I used lua-resty-session 4.1.4 and here is code snippet.
access_by_lua_block >>>>>>>>>>
local session = nil
local req_uri, arg_z = ngx.var.uri, ngx.var.arg_z
if req_uri == "/entry" then
session = require "resty.session".start({
cookie_secure=true,
cookie_httponly = true,
cookie_same_site="None",
})
session:set("userid", arg_z)
session:save()
ngx.log(ngx.ERR, "**** Set session userid: "..arg_z)
local args = ngx.req.get_uri_args()
args["z"] = nil
ngx.req.set_uri_args(args)
else
session = require "resty.session".start({
cookie_secure=true,
cookie_httponly = true,
cookie_same_site="None",
})
end
local s_user_id = session:get("userid")
if not s_user_id then
ngx.log(ngx.ERR, "**** No session - userid")
return ngx.exit(ngx.HTTP_FORBIDDEN)
end
<<<<<<<<<
I use test on Chrome Desktop browser. Session mostly works but, got rarely "No session - userid".
I think there are still bugs in "lua-resty-session 4.1.4"
I need to use this library for my project, but getting troubles with it.
Please help me to figure it out asap.