Add annotation for setting sticky cookie domain (#9088)

This adds the new annotation `nginx.ingress.kubernetes.io/session-cookie-domain`
for setting the cookie `Domain` attribute of the sticky cookie.

Signed-off-by: Matthias Neugebauer <mtneug@mailbox.org>

Signed-off-by: Matthias Neugebauer <mtneug@mailbox.org>
This commit is contained in:
Matthias Neugebauer 2022-09-28 16:28:37 +02:00 committed by GitHub
parent 077c0414aa
commit 26fe69cb47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 74 additions and 1 deletions

View file

@ -110,6 +110,10 @@ function _M.set_cookie(self, value)
cookie_data.max_age = tonumber(self.cookie_session_affinity.maxage)
end
if self.cookie_session_affinity.domain and self.cookie_session_affinity.domain ~= "" then
cookie_data.domain = self.cookie_session_affinity.domain
end
local ok
ok, err = cookie:set(cookie_data)
if not ok then