Skip to content

Custom lists

A custom list contains one or more items of the same type (for example, IP addresses, hostnames, or ASNs) that you can reference collectively, by name, in rule expressions.

Cloudflare supports the following custom list types:

Each type has its own properties and CSV file format. Refer to the following sections for details.

For more information on lists managed by Cloudflare, such as Managed IP Lists, refer to Managed Lists.

Create a custom list

Refer to Create a list in the dashboard or to the Lists API page.

Use a custom list

Use custom lists in rule expressions with the in operator and with a field supported by the custom list:

<FIELD> in $<LIST_NAME>

The fields you can use vary according to the list item type:

List item type Available fields
IP address Fields with type IP address listed in the Fields reference
Hostname http.host
ASN ip.src.asnum

For more information and examples, refer to Use lists in expressions.

IP and ASN lists across Rules products

You can reuse custom IP and ASN lists in customer-owned rule filters across CDN phases. For example, use the same list in WAF custom rules, Cache Rules, Redirect Rules, and request or response Header Transform Rules.

Response-side support includes Response Header Transform Rules and rate limiting counting expressions. You can combine a list reference with response fields to select which responses count toward a rate limit.

Use ip.src with an IP list:

ip.src in $office_network

Use ip.src.asnum with an ASN list:

ip.src.asnum in $partner_networks

The list must belong to the account that owns the rule. Existing plan availability and list limits still apply. ASN lists require an Enterprise plan.

This support applies to filter expressions that determine whether a rule runs. It does not add list support to dynamic action-value expressions. Hostname lists retain their product-specific restrictions.


Custom list types

Lists with IP addresses (IP lists)

List items in custom lists with IP addresses must be in one of the following formats:

  • Individual IPv4 addresses
  • Individual IPv6 addresses
  • IPv4 CIDR ranges with a prefix from /8 to /32
  • IPv6 CIDR ranges with a prefix from /12 to /128

The same list can contain both individual addresses and CIDR ranges.

Cloudflare normalizes IPv6 addresses in lists. When you save a list, Cloudflare converts uppercase characters to lowercase and removes leading zeros from each segment. For example, 2400:d400:0011:19::2 is stored as 2400:d400:11:19::2. When searching list items, use the normalized form displayed in the list.

CSV file format

When uploading items to a custom list with IP addresses via CSV file, use the following file format (enter one item per line):

<IP_ADDRESS_1>,<DESCRIPTION>
<IP_ADDRESS_2>

The <DESCRIPTION> field is optional.

Lists with hostnames

List items in custom lists with hostnames must be Fully Qualified Domain Names (FQDNs). An item may contain a * prefix/subdomain wildcard, which must be followed by a . (period). An item cannot include a scheme (for example, https://) or a URL path.

For example, the following entries would be valid for a custom list with hostnames:

  • example.com
  • api.example.com
  • *.example.com

However, example.com/path/subfolder would not be a valid entry.

You can add any valid hostname (a valid FQDN) to a custom list with hostnames. The hostnames do not need to belong to the current Cloudflare account.

CSV file format

When uploading items to a custom list with hostnames via CSV file, use the following file format:

<HOSTNAME_1>,<DESCRIPTION>
<HOSTNAME_2>

The <DESCRIPTION> field is optional.

Lists with ASNs

List items in custom lists with autonomous system numbers (ASNs) must be integer values.

For example, the following entries would be valid for a list with ASNs:

  • 1
  • 13335
  • 64512

CSV file format

When uploading items to a custom list with ASNs via CSV file, use the following file format:

<ASN_1>,<DESCRIPTION>
<ASN_2>

The <DESCRIPTION> field is optional.

Was this helpful?