Content-Security-Policy (CSP)
  • is an HTTP response header that allows a website to control resources the user agent is allowed to load for a given page
  • helps guard against Cross-Site Scripting (XSS) attacks

Syntax

  • Content-Security-Policy: <policy-directive>[; <policy-directive>]*

where:

  • <policy-directive> consists of: <directive> <value> with no internal punctuation

Policy

Your policy should include a default-src policy directive, which is a fallback for other resource types when they don’t have policies of their own (for a complete list, see the description of the default-src directive

Examples

Subpages

Resources