A list of what your page is allowed to load
A Content Security Policy (CSP) is a response header that tells the browser which sources of scripts, styles, images, fonts, frames and network requests a page may use. Anything not allowed is blocked. Its main job is to stop cross-site scripting: if an attacker manages to inject a script into your page, a good policy stops the browser from running it. A weak policy looks protective on paper while allowing almost everything.
This CSP header checker fetches your URL and reads the enforced Content-Security-Policy header. If there is none, it looks for a CSP meta tag in the HTML, and then for a Content-Security-Policy-Report-Only header. It splits the policy into directives, lists the sources each one allows, and flags specific weaknesses with a severity and a suggested fix.
Every finding the analyzer can raise
Critical: no policy at all; 'unsafe-inline' in script-src without a nonce or hash; 'unsafe-eval' in script-src; and a wildcard or scheme-wide script source such as *, https: or data: (unless 'strict-dynamic' is used, which makes browsers ignore those).
Warnings: the policy is report-only, so nothing is actually blocked; no default-src, so resource types without their own rule are unrestricted; no script-src or default-src at all; a * wildcard in other directives such as img-src or connect-src; and no frame-ancestors, which leaves the page open to clickjacking unless X-Frame-Options is set.
Notes: 'unsafe-inline' sitting next to nonces or hashes (modern browsers ignore it then, so it is only a fallback for very old ones); no object-src; no base-uri; frame-ancestors placed in a meta tag, where browsers ignore it; and no report-uri or report-to, which means you cannot see what the policy blocks for real visitors.
Weak versus strong, side by side
This policy exists, but it allows scripts from anywhere and inline code, so it stops almost nothing:
Content-Security-Policy: default-src *; script-src * 'unsafe-inline' 'unsafe-eval'This one uses a fresh nonce on every page load. Only script tags carrying that nonce run, and 'strict-dynamic' lets those trusted scripts load the scripts they need without listing every domain:
Content-Security-Policy:
default-src 'self';
script-src 'nonce-r4nd0mPerRequest' 'strict-dynamic';
style-src 'self' 'unsafe-inline';
img-src 'self' data: https://images.example-cdn.com;
connect-src 'self' https://www.google-analytics.com;
object-src 'none';
base-uri 'self';
frame-ancestors 'self';
report-to csp-endpointNote that style-src keeps 'unsafe-inline' here. That is a common, acceptable trade-off: inline styles are far less dangerous than inline scripts, and many sites and plugins depend on them. Focus your effort on script-src first.
Rolling out a policy without breaking the site
A strict policy written from memory will almost certainly block something you need: your analytics, tag manager, chat widget, payment form, fonts or video embeds. The safe path is report-only mode. Browsers load everything as normal but report each request your policy would have blocked. Collect those reports for a week or two across your key pages, adjust the policy, and switch to the enforcing header once the reports are quiet.
# Start in report-only mode: nothing is blocked, violations are reported
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' https://www.googletagmanager.com; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-uri /csp-reports" always;Apache
Use Header always set Content-Security-Policy-Report-Only "..." in the HTTPS virtual host (mod_headers), then rename it to Content-Security-Policy when you are ready to enforce.
Cloudflare
Add the header with a Transform Rule that modifies response headers. Cloudflare's own scripts, such as bot challenges or email obfuscation, may need allowing; the reports will show them.
WordPress and Google Tag Manager
WordPress themes and plugins rely heavily on inline scripts, so a nonce-based policy usually needs a plugin or custom code that adds the nonce to every script tag. Google Tag Manager loads scripts from many domains depending on your tags; Google publishes CSP guidance for GTM, and 'strict-dynamic' with a nonce on the GTM snippet is the cleanest approach.
Shopify
Shopify does not let you set custom response headers on storefronts, so a full CSP is not something you can control there. Focus on keeping third-party apps and scripts to the ones you trust.
Header or meta tag?
A policy can also be set with a meta http-equiv tag in the page head. That works for most directives but not all: frame-ancestors, report-uri and sandbox are ignored in a meta tag. If you can set headers, use the header. If both exist, browsers apply both, and a resource must pass each policy, which makes problems hard to trace.
Security, not a ranking lever
CSP is not a Google ranking factor. Its SEO value is defensive: a cross-site scripting attack that injects spam links, redirects or malware can lead to Safe Browsing warnings and lost visibility, and CSP makes that much harder. The flip side is that a broken policy can block scripts your page needs to render, so test key templates in a browser and check that important content still appears after each change. Our article on security headers and SEO covers how CSP fits alongside the others.
Fix order once you have the report
No policy? Start with report-only. A policy with 'unsafe-inline' or 'unsafe-eval' in script-src? Move inline scripts into files or give them nonces, remove code that needs eval, and re-run the check. Then replace wildcards with the specific domains you use, and add object-src 'none', base-uri 'self' and frame-ancestors. Add a report endpoint so future breakage is visible. Re-check whenever you add a third-party tag. If http:// files on HTTPS pages are your concern rather than script control, the Mixed Content Checker covers the upgrade-insecure-requests side, and the HTTP Header Checker shows CSP next to every other security header.