Merge pull request #3372 from Shopify/session-cookie-path

Add annotation for session affinity path
This commit is contained in:
k8s-ci-robot 2018-11-19 07:25:32 -08:00 committed by GitHub
commit 82721e575d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,
traffic_shaping_policy = backend.trafficShapingPolicy,
alternative_backends = backend.alternativeBackends,
@ -41,10 +42,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,
}