Adds Wilcard check for hostname. Adds wildcard hostname tests.

This commit is contained in:
Zovin Khanmohammed 2019-08-21 18:17:42 -05:00
parent d51809c957
commit 1f8ab60e40
No known key found for this signature in database
GPG key ID: 04CBAED972E403BD
2 changed files with 216 additions and 0 deletions

View file

@ -105,6 +105,16 @@ end
local function should_set_cookie(self)
if self.cookie_session_affinity.locations then
local locs = self.cookie_session_affinity.locations[ngx.var.host]
if locs == nil then
-- Based off of wildcard hostname in ../certificate.lua
local wildcardHostname, _, err = ngx.re.sub(ngx.var.host, "^[^\\.]+\\.", "*.", "jo")
if err then
ngx.log(ngx.ERR, "error: ", err);
elseif wildcardHostname then
locs = self.cookie_session_affinity.locations[wildcardHostname]
end
end
if locs ~= nil then
for _, path in pairs(locs) do
if ngx.var.location_path == path then