Optional hardening
Your site has no list of what scripts are allowed to run
Your site has no Content Security Policy (CSP), a list that tells browsers which scripts, styles and other files your pages are allowed to load. It is optional hardening. A good one takes care to build and can break a site if rushed, so start in Report-Only mode, which only watches and blocks nothing.
Your site has no list of what scripts are allowed to run. There is no Content Security Policy. Any script that gets onto a page, from any source, is allowed to run.
Send the technical line below to whoever runs your site. Each of these is a one-line change in the server or hosting settings, and none of them changes how the site looks.
What it means
A web page pulls in many pieces: your own scripts, analytics, a chat widget, fonts, maps, a payment button. By default, a browser runs a script from any address the page mentions.
A Content Security Policy is an allowlist your server sends with each page. It says, for example, run scripts only from my own site and from my payment provider, and refuse everything else. Your site does not send one, so browsers allow everything.
A CSP does not stop someone from breaking into your site. It limits what injected code can do once it is on a page, for example stopping it from loading more code from an attacker's server.
Why it matters
Small business sites get injected code through outdated plugins, compromised third-party scripts, or hacked accounts. That code can show spam, redirect visitors, or copy what they type into forms. A well-built CSP is the single setting that most limits that damage.
The catch is that a CSP has to list everything your site legitimately uses. Miss one, and that piece stops working: a chat box disappears, a form will not submit, analytics goes quiet. Sites that add plugins, apps and marketing tags often are the hardest to cover.
That is why EverThread rates this as optional. Plenty of well-run sites do not have one.
How to check your own site
- Open your home page in Chrome, Edge or Firefox. Right-click the page, choose Inspect, and open the Network tab.
- Reload the page. Click the first row in the list, which is the page itself, and look at the Response Headers section.
- Look for
content-security-policy. If you only seecontent-security-policy-report-only, a policy is being tested but not enforced. - To see what a policy would block, open the Console tab. Each problem appears as a message naming the address and the rule it broke.
How to fix it
Any website
- List every outside service your site uses: analytics, tag managers, chat, fonts, maps, video, payment, booking and ad tools. Many list the addresses they need in their help pages, under a heading about Content Security Policy.
- Start with the Report-Only header below. It uses the name
Content-Security-Policy-Report-Only, so browsers report problems but block nothing. Add the addresses from your list to the right lines. For example, a script fromhttps://www.googletagmanager.comgoes on thescript-srcline. - Browse your important pages with the Console tab open: home, contact form, checkout, login. Every report is something to either add to the policy or remove from the site.
- Leave Report-Only running for a few weeks, and recheck after adding any plugin or tag. When nothing new appears, rename the header to
Content-Security-Policyto enforce it. - EverThread looks for the enforced header, so it will keep showing this note while you are in Report-Only mode. That is expected.
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; frame-src 'self'; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'WordPress
- Set the policy at the server or CDN, using the Apache, Nginx or Cloudflare steps below. That is more reliable than a plugin.
- Be realistic about scripts. Many themes and plugins put small scripts directly in the page. A policy that blocks those will break them, and allowing them with
'unsafe-inline'weakens the protection. Even so, a policy that limits which outside sites scripts can come from is still worth having. - Check the admin area and your page builder as well as public pages. If the admin breaks, apply the policy to public pages only, or ask your developer to exclude
/wp-admin/.
Shopify, Squarespace, Wix and other hosted builders
- These platforms run the servers, so you cannot set this header. Some send their own policies on parts of the site, such as checkout.
- A CSP can technically go in a tag on the page, but Report-Only mode does not work that way. On these platforms, apps and the platform itself add scripts you do not control and that change without notice. A policy you write by hand is likely to break something. For most shops on these platforms, the honest advice is to leave this alone.
Cloudflare
- Go to Rules and create a response header rule. Depending on your dashboard, this is under Transform Rules, then Modify Response Header, or under Rules, Overview, as a Response Header Transform Rule.
- Apply it to all incoming requests. Choose Set static, enter
Content-Security-Policy-Report-Onlyas the header name, and paste your policy as the value. Deploy. - When you are ready to enforce, edit the rule and change the header name to
Content-Security-Policy.
Apache (.htaccess)
- Add these lines to the
.htaccessfile in your site's main folder, or to your server's site settings, with your own addresses added. This needs themod_headersmodule. - Keep the policy on one line. To enforce, change
Content-Security-Policy-Report-OnlytoContent-Security-Policy.
<IfModule mod_headers.c>
Header always set Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; frame-src 'self'; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'"
</IfModule>Nginx
- Add this line inside your site's
serverblock with your own addresses added, then reload Nginx. To enforce, change the header name toContent-Security-Policy.
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; frame-src 'self'; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'" always;
What to send your developer
Roll out with Content-Security-Policy-Report-Only and collect reports from real traffic, not just your own browsing: declare an endpoint with the Reporting-Endpoints header and report-to, and keep report-uri as a fallback for browsers that do not support it. For scripts, prefer nonces or hashes with 'strict-dynamic' over long host allowlists, which are easy to bypass through permissive CDNs. If you have to start with 'unsafe-inline', still set object-src 'none', base-uri 'self' and frame-ancestors, which are low-risk wins. Report-Only, frame-ancestors and report-uri are ignored in a <meta> policy. You can run an enforced baseline and a stricter Report-Only policy side by side while you tighten. See MDN on CSP and the OWASP CSP cheat sheet.
Reporting-Endpoints: csp="https://example.com/csp-reports"
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-to csp; report-uri https://example.com/csp-reports
Common questions
Can a Content Security Policy break my site?
Yes, when it is enforced. Anything the policy does not list is blocked, and a blocked script can take a form, a checkout button or a chat widget down with it. Report-Only mode exists so you can find those gaps first without affecting visitors.
Where do I see the reports?
Without extra setup, each browser shows them in its developer tools Console tab, which is enough to test your own pages. To collect reports from real visitors, your developer can point the policy at a reporting address that stores them.
Is it worth doing for a small site?
It depends on how often your site changes and who maintains it. A simple site with few outside tools can get a solid policy in an afternoon. A site with many plugins, apps and marketing tags will need ongoing care. If nobody will maintain it, a policy that breaks something later does more harm than good.