Create a content security rule in the dashboard
Last updated Aug 3, 2026 Note
Only available to customers with Client-Side Security Advanced.
- In the Cloudflare dashboard, go to the Security rules page. Go to Security rules ↗
- Select Create > Content security rules.
- Enter a descriptive name for the rule in Description.
- Under If incoming requests match, define the scope of the content security rule (or policy). You can use the Expression Builder (specifying one or more values for Field, Operator, and Value) or manually enter an expression using the Expression Editor. For more information, refer to Edit expressions in the dashboard.
- Under Allow these directives, select the desired CSP directives for the content security rule by enabling one or more checkboxes.
- To manually enter an allowed source, select Add source.
-
To refresh the displayed sources based on detected resources, select Refresh suggestions.
Note
Cloudflare provides suggestions for Default, Scripts, and Connections directives. For the Default directive, suggestions are based on monitored scripts and connections resources. 6. Under Then take action, select the desired action: - Allow: Enforces the CSP directives configured in the rule, blocking any other resources from being loaded on your website, and logging any rule violations. - Log: Logs any content security rule violations without blocking any resources not covered by the rule. 7. To save and deploy your rule, select Deploy. If you are not ready to deploy your rule, select Save as Draft.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/client-side-security/rules/create-dashboard/#page","headline":"Create a content security rule in the dashboard","description":"Learn how to create a content security rule in the Cloudflare dashboard.","url":"https://developers.cloudflare.com/client-side-security/rules/create-dashboard/","inLanguage":"en","image":"https://developers.cloudflare.com/client-side-security/rules/create-dashboard/og.png?v=fd9a0310a36e08ba","dateModified":"2026-08-03","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/"},"keywords":["CSP"]}
description: CSP directives supported by content security rules title: Supported CSP directives image: https://developers.cloudflare.com/client-side-security/rules/csp-directives/og.png?v=fe9c6b901a165833
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/client-side-security/llms.txt
Use this file to discover all available pages before exploring further.
Docs