chore: Add interest-cohort directive to Permissions-Policy header in headers.lua only if it's not already present

This commit is contained in:
Théophile Diot 2024-06-25 11:57:07 +01:00
parent a83ea84f50
commit b01a4822ad
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -98,7 +98,7 @@ function headers:header()
ngx_header["Content-Security-Policy-Report-Only"] = self.variables[variable]
elseif header == "Permissions-Policy" then
ngx_header[header] = self.variables[variable]
if self.variables["DISABLE_FLOC"] == "yes" then
if self.variables["DISABLE_FLOC"] == "yes" and not ngx_header[header]:find("interest-cohort") then
ngx_header[header] = ngx_header[header] .. ", interest-cohort=()"
end
else