Update headers core plugin lua code

This commit is contained in:
Théophile Diot 2023-06-05 21:33:42 -04:00
parent afe6da4cf5
commit 654172f436
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ function headers:header()
end
-- Add custom headers
for srv, vars in pairs(variables) do
if srv == ngx.var.server_name then
if srv == ngx.ctx.bw.server_name then
for var, value in pairs(vars) do
if utils.regex_match(var, "CUSTOM_HEADER") and value then
local m = utils.regex_match(value, "([\\w-]+): ([^,]+)")
@ -47,7 +47,7 @@ function headers:header()
end
end
-- Remove headers
if self.variables["REMOVE_HEADERS"] then
if self.variables["REMOVE_HEADERS"] ~= "" then
local iterator, err = ngx.re.gmatch(self.variables["REMOVE_HEADERS"], "([\\w-]+)")
if not iterator then
return self:ret(false, "Error while matching remove headers: " .. err)