Create, edit, and delete rules

Before getting started, become familiar with:

Create a rule

To configure a basic firewall rule:

  1. Log in to the Cloudflare dashboard.

  2. Ensure the website where you want to apply your new rule is selected.

  3. Click the Firewall app.

  4. In the Firewall Rules panel, click Create new rule. A dialog opens where you will provide the details of your new rule. Create new firewall rule

  5. Enter a Rule name.

  6. For When incoming requests match…, use the Visual Expression Builder to add a condition.

  7. To build an expression with multiple conditions, click:

    • And - to evaluate conditions using and logic, or
    • Or - to evaluate conditions or groups of previously and‘ed conditions using or logic.
  8. Observe that as you enter a condition, the Expression Editor below shows the expression in plain text.

    In the Expression Editor, you can click to edit your expression manually instead of using the Visual Expression Builder, or switch between the two. However depending on the complexity of a manually constructed expression, the Visual Expression Builder might not be able to render it.

  9. For Then…, pick an action from the dropdown:

  10. To save your rule, decide on the most appropriate option by clicking:

    • Save as Draft - to save your rule but leave it paused

    • Save and Deploy - to save your rule and activate it

  11. To adjust the order, drag and drop your new rule accordingly.

    Drag and drop is the default functionality when you have under 201 rules. To switch to priority numbering, click Ordering and select Priority numbers. Learn more about order and priority.


Edit a rule

To edit an existing rule:

  1. Log in to the Cloudflare dashboard.

  2. Ensure the website where you want to apply your new rule is selected.

  3. Click the Firewall app.

  4. In the Firewall Rules panel, locate the rule to modify and click the Edit icon (wrench). The Edit Firewall Rule dialog opens.

  5. Enter the changes you’d like to make.

  6. Click Save.

  7. In the list of existing rules, perform drag and drop to adjust the order.

    Drag and drop is the default functionality when you have under 201 rules. To switch to priority numbering, click Ordering and select Priority numbers. Learn more about order and priority.

  8. To pause or activate any rule in list of existing rules, click the On/Off toggle, accordingly.


Delete a rule

To edit an existing rule:

  1. Log in to the Cloudflare dashboard.

  2. Ensure the website where you want to apply your new rule is selected.

  3. Click the Firewall app.

  4. In the Firewall Rules panel, locate the rule to modify and click the Delete icon (X).

  5. In the delete confirmation dialog, click Delete to proceed.