Skip to main content
Email & Website Security·Updated 2026-10-21

What is a Content Security Policy (CSP)?

Short answer

A Content Security Policy is an HTTP header that tells the browser which sources of scripts, styles, images and frames a page may load. A well-built CSP greatly reduces the impact of cross-site scripting by blocking scripts the site did not approve.

The details

Start with Content-Security-Policy-Report-Only to see what would break, then tighten the policy. Nonce- or hash-based policies are stronger than long allowlists of domains.

Useful next reads and tools

Terms explained

Content Security Policy
Content Security Policy (CSP) is an HTTP response header that tells the browser which sources a page may load scripts, styles, images and frames from.

Sources

Related questions