Code Review changes. Remove duplicate tests.

This commit is contained in:
Zovin Khanmohammed 2019-08-26 10:22:07 -05:00
parent 1f8ab60e40
commit 76c2063be8
No known key found for this signature in database
GPG key ID: 04CBAED972E403BD
2 changed files with 9 additions and 180 deletions

View file

@ -103,15 +103,15 @@ local function pick_new_upstream(self)
end
local function should_set_cookie(self)
if self.cookie_session_affinity.locations then
if self.cookie_session_affinity.locations and ngx.var.host 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")
local wildcard_host, _, 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]
elseif wildcard_host then
locs = self.cookie_session_affinity.locations[wildcard_host]
end
end