Security alerts eMudhra CA compromise · Chrome drops the root Oct 27 Check your certificate → PHP2Shell · is your PHP version exposed? Check your site →

Help › Fix guides › Content-Security-Policy missing

Fix guide · Web application · low

Content-Security-Policy missing

A Content-Security-Policy tells the browser which sources your pages may load scripts, styles and frames from. Without one, a single injected script (from a vulnerable plugin, a compromised ad or a comment field) runs with full access to the page and your visitors' sessions.

Time to fix

30 minutes to a few hours

Risk if ignored

Injected scripts run unrestricted

Breaks anything?

It can, so start in report-only mode

How to fix it

Start in report-only mode, in the server block:

add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; frame-ancestors 'self'" always;

Watch the browser console for a few days, add the sources you actually use, then rename the header to Content-Security-Policy.

Even a loose policy with frame-ancestors 'self' is a real improvement. Tighten it over time.

Check your fix

Rescan and we’ll confirm it’s fixed.

Common mistakes

  • Enforcing a strict policy on day one and breaking analytics, fonts or embeds.
  • Adding 'unsafe-eval' "just to make it work". It removes most of the protection.
  • Setting it in a <meta> tag only. frame-ancestors is ignored there.

Still stuck?

Ask a human. We answer every ticket.

Tickets are answered 7am–7pm Pacific, usually within a few hours. Your whole conversation stays in your account.

Live chat, inside your ticket

On a Pro or Enterprise plan? Open any ticket and, when we’re online, chat with us live right there. The chat is saved on the ticket with everything else, so nothing gets lost.

Free plan: tickets only. Same people, same answers.

Not a customer yet? Questions about plans go to sales.