Create a custom rule in the dashboard

Last updated Oct 8, 2026 1. In the Cloudflare dashboard, go to the Security rules page. Go to Security rules ↗ 2. To create a new empty rule, select Create rule > Custom rules. To duplicate an existing rule, select the three dots next to it > Duplicate. 3. Enter a descriptive name for the rule in Rule name.Custom rule creation page in the Cloudflare dashboard 4. Under When incoming requests match, use the Field drop-down list to choose an HTTP property. For each request, the value of the property you choose for Field is compared to the value you specify for Value using the operator selected in Operator. 5. Under Then take action, select the rule action in the Choose action dropdown. For example, selecting Block tells Cloudflare to refuse requests that match the conditions you specified.

To validate a new rule before enforcing it, use the Log action (Enterprise plans only). On plans where Log is not available, start with Managed Challenge, review the matched requests in Security Events, and then switch to Block. 6. (Optional) If you selected the Block action, you can configure a custom response. 7. To save and deploy your rule, select Deploy. If you are not ready to deploy your rule, select Save as Draft.

Configure a custom response for blocked requests

Note

This feature is only available on Pro plans and above.

When you select the Block action in a rule you can optionally define a custom response.

The custom response has three settings:

  • With response type: Choose a content type or the default WAF block response from the list. The available custom response types are the following:
Dashboard value API value
Custom HTML "text/html"
Custom Text "text/plain"
Custom JSON "application/json"
Custom XML "text/xml"
- With response code: Choose an HTTP status code for the response, in the range 400-499. The default response code is 403.
- Response body: The body of the response. Configure a valid body according to the response type you selected. The maximum field size is 2 KB.

Was this helpful?

YesNo

On this page

Create a custom rule in the dashboard - 图2Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/custom-rules/create-dashboard/#page","headline":"Create a custom rule in the dashboard","description":"Create WAF custom rules in the Cloudflare dashboard.","url":"https://developers.cloudflare.com/waf/custom-rules/create-dashboard/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/custom-rules/create-dashboard/og.png?v=a4f577ce45cb7443","dateModified":"2026-10-08","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: Create and manage zone-level custom rulesets for WAF rules. title: Custom rulesets (zone level) image: https://developers.cloudflare.com/waf/custom-rules/custom-rulesets/og.png?v=3bb0ad69da39d3f3


Skip to content

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