Cloudflare Docs
Firewall Rules
Visit Firewall Rules on GitHub
Set theme to dark (⇧+D)

Use lists in expressions

​​ Expression Builder

To use an IP List in the Expression Builder:

  1. Select is in list or is not in list from the Operator drop-down list.

    Selecting an IP List from the Value drop-down list when configuring the expression of a firewall rule

  2. Select an IP List from the Value drop-down list. Depending on your plan, you may be able to select an IP List managed by Cloudflare.

  3. When you are done composing your rule, select Deploy to commit your changes and enable your rule. If you are not ready to enable the rule, select Save as draft.

​​ Expression Editor

To use an IP List in the Expression Editor specify the in operator and use $<list_name> to specify the name of the list.

This expression filters requests from IP addresses that are in an IP List named office_network:

(ip.src in $office_network)

Note that names for IP Lists can only include lowercase letters, numbers, and the underscore (_) character.

For more on creating lists, refer to Work with lists.

To create a new rule via API using a Managed IP List — for example, cf.open_proxies — use the following expression:

(ip.src in $cf.open_proxies)

The available Managed IP Lists depend on your Cloudflare plan. For more information, refer to Managed IP Lists.