Content Security Policy guides
How to add a policy, read the reports browsers send, and fix what gets blocked.
- Adding a CSP header
Copy-and-paste CSP headers for nginx, Apache, Express, Next.js, Cloudflare, Netlify, Vercel and IIS, and how to check that they work.
- Testing a policy with report-only
Test a Content Security Policy without breaking your site: a first header to copy, where reports go, how long to wait, and how to enforce it.
- Reading a CSP violation report
What each field in a CSP report means, how to spot reports caused by extensions and antivirus, and which ones to look at first.
- Fixing “violates the following Content Security Policy directive”
What each CSP console error means and how to fix it: blocked scripts, inline code, styles, fonts, API calls, frames and eval.
- CSP sources for common services
The Content Security Policy sources documented by Google Tag Manager, Google Analytics, Stripe, reCAPTCHA, Turnstile, hCaptcha and Sentry.
- report-uri and report-to compared
Use both. How report-uri and report-to differ in browser support, report format and delivery, with headers to copy and the mistakes that lose reports.
- PCI DSS 6.4.3 and 11.6.1
What PCI DSS 4.0.1 asks of payment page scripts, which parts Content Security Policy helps with, and which parts need something else.
- CSP checker
Paste a policy to see what is wrong with it. It runs in your browser and nothing is sent to us.