Add annotation for session affinity path

This commit is contained in:
Zenara Daley 2018-11-19 09:15:24 -05:00
parent d53b492d73
commit 50b29feb4a
8 changed files with 105 additions and 7 deletions

View file

@ -17,6 +17,7 @@ function _M.new(self, backend)
cookie_name = backend["sessionAffinityConfig"]["cookieSessionAffinity"]["name"] or "route",
cookie_expires = backend["sessionAffinityConfig"]["cookieSessionAffinity"]["expires"],
cookie_max_age = backend["sessionAffinityConfig"]["cookieSessionAffinity"]["maxage"],
cookie_path = backend["sessionAffinityConfig"]["cookieSessionAffinity"]["path"],
digest_func = digest_func,
}
setmetatable(o, self)
@ -39,10 +40,15 @@ local function set_cookie(self, value)
ngx.log(ngx.ERR, err)
end
local cookie_path = self.cookie_path
if not cookie_path then
cookie_path = ngx.var.location_path
end
local cookie_data = {
key = self.cookie_name,
value = value,
path = ngx.var.location_path,
path = cookie_path,
domain = ngx.var.host,
httponly = true,
}