What is Content-Security-Policy?
Also called: CSP
A content security policy (CSP) lists where scripts, styles, images and other files may come from, and who may show your page in a frame. A browser then blocks anything that breaks the list. It is one of the main defences against injected code.
Why it matters
It mainly protects visitors by limiting what harmful code can do on your pages. It builds trust, and we make no claim that it changes search or AI answers.
How Onbiom checks it
Onbiom's rule: inside the combined browser protection check, the homepage response must have a Content-Security-Policy header. If it is missing the check fails. A frame-ancestors rule in this header also counts as framing protection.
We only check that the header is there. Header strength is not assessed, so a weak policy and a strict one both pass. Content-Security-Policy has no row of its own. This is a safety advisory about your visitors, reported apart from search visibility.
In your report this appears as: Content-Security-Policy that limits scripts.
How to check it yourself
- Run the command below against your own address.
- Check that a content-security-policy line appears.
curl -sI https://example.com | grep -i content-security-policyNot sure about your own site? Paste your address and see in a minute which of these checks your site passes. Free, no account needed.
How to fix it
- Any website
- Ask your host or web person to add a policy. A safe starter such as frame-ancestors 'self' only limits who may frame your pages and cannot break scripts or styles.
- Cloudflare
- Cloudflare: open Rules, then Overview, create a Response Header Transform Rule and add the header as a static header.
- nginx
- nginx: add the line to your server block with add_header, then reload nginx.
- Apache
- Apache: add the line with the Header directive in your site configuration or .htaccess file (needs mod_headers), then reload.
Related terms
Sources and further reading
Last reviewed: