Fix Access-Control-Allow-Credentials not being set to the right value when deactivated

This commit is contained in:
Théophile Diot 2023-05-09 10:05:48 -04:00
parent 50ee37db0a
commit 30194f9599
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
1 changed files with 4 additions and 2 deletions

View File

@ -33,8 +33,10 @@ function cors:header()
-- Preflight request
if ngx.ctx.bw.request_method == "OPTIONS" then
for variable, header in pairs(self.preflight_headers) do
if variable == "CORS_ALLOW_CREDENTIALS" and self.variables["CORS_ALLOW_CREDENTIALS"] == "yes" then
ngx.header[header] = "true"
if variable == "CORS_ALLOW_CREDENTIALS" then
if self.variables["CORS_ALLOW_CREDENTIALS"] == "yes" then
ngx.header[header] = "true"
end
elseif self.variables[variable] ~= "" then
ngx.header[header] = self.variables[variable]
end