webzod
account

Fix the Content-Security-Policy syntax on Cloudflare

headers.csp.invalid · effort: minutes

Why it matters

Browsers skip directives they do not know and read unquoted keywords as host names, so parts of the policy silently do nothing. The finding's details list what was ignored.

Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.

The fix

  1. Stage 1: add a Response Header Transform Rule with Set static, header Content-Security-Policy-Report-Only and the corrected policy, and check the reports.
  2. Stage 2: put the corrected value into wherever the enforced policy is set (the rule or the origin) and delete the report-only rule.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.