Content Security Policies (CSPs)

Last updated Apr 20, 2026 A Content Security Policy (CSP) is an added layer of security that helps detect and mitigate certain types of attacks, including:

  • Content/code injection
  • Cross-site scripting (XSS)
  • Embedding malicious resources
  • Malicious iframes (clickjacking)

To learn more about configuring a CSP in general, refer to the Mozilla documentation ↗︎.

Using a CSP with Cloudflare

Cloudflare's CDN is compatible with CSP.

Cloudflare does not:

If you require the CSP headers to be changed or added, you can change them using some Cloudflare products:

Product requirements

To use certain Cloudflare features, however, you may need to update the headers in your CSP:

Feature(s) Updated headers
Rocket Loader script-src 'self' ajax.cloudflare.com;
Scrape Shield script-src 'self' 'unsafe-inline'
Web Analytics script-src static.cloudflareinsights.com; connect-src cloudflareinsights.com
Bot products Refer to JavaScript detections and CSPs.
Client-side security (formerly Page Shield) Refer to CSP header format.
Zaraz No updates required (details ↗︎).
Turnstile Refer to Turnstile CSP.

Was this helpful?

YesNo

On this page

Content Security Policies (CSPs) - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/fundamentals/reference/policies-compliances/content-security-policies/#page","headline":"Content Security Policies (CSPs)","description":"Understand how Cloudflare interacts with Content Security Policies (CSPs) and which headers to update for specific Cloudflare features.","url":"https://developers.cloudflare.com/fundamentals/reference/policies-compliances/content-security-policies/","inLanguage":"en","image":"https://developers.cloudflare.com/fundamentals/reference/policies-compliances/content-security-policies/og.png?v=2ed3c96d7367cd26","dateModified":"2026-04-20","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Project Cybersafe Schools provides eligible schools with free Cloudflare Email Security and Gateway products to meet CIPA requirements. title: Project Cybersafe Schools image: https://developers.cloudflare.com/fundamentals/reference/policies-compliances/cybersafe/og.png?v=8540bc2067b87ea8


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/fundamentals/llms.txt
Use this file to discover all available pages before exploring further.