The short answer: Content Security Policy (CSP) is a header that tells the browser where the site may load scripts, styles and images from. If someone injects an outside script, the browser refuses it. It is strong, but it is also easy to break a site with it; so you start in report-only mode, which only warns and blocks nothing.
What the site needs
| What | What to do |
| What it controls | Allowed origins for the site’s scripts, styles, images, fonts, videos and connections. |
| Report-only mode | The Content-Security-Policy-Report-Only header records what it would block, without blocking. It is the mode for rehearsing. |
| What usually breaks | Scripts and styles written inside the page itself, Google Analytics and Tag Manager, outside fonts, embedded videos: Tag Manager. |
| A first policy | Accept everything only from the site itself, then add the outside origins the site really uses. |
| When to start blocking | When the log has been clean for a few days, on all the important pages. |
Getting started
|
|
|
|
|
| A policy that is too tight breaks the site. If you go straight to the blocking mode you may lose the menu, the form or the checkout without warning. Always test in report-only mode, and in another browser. If something breaks, go back to the copy of .htaccess. |
| If your site mixes http and https content, fix that first: Mixed content. Another header to turn on with care: HSTS. |
|
Want help rehearsing a policy for your site? Open a ticket with the address. Open a support ticket |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from KSh858.00/mo (3-year plan, with coupon) See plans |
- 0 Users Found This Useful











