| [ Web Proxy ] |
| Viewing: https://developers.cloudflare.com/cloudflare-one/reusable-components/lists/ | [Back] [Original] |
With Cloudflare One, you can create lists of URLs, hostnames, or other entries to reference when creating Gateway policies or Access policies. This allows you to quickly create rules that match and take actions against several items at once.
Before creating a list, make note of the limitations.
Note
The lists described in this page are not the same as custom lists defined at the account level. The two types of lists support different data types and have different validation rules.
Lists can contain a single type of data each. Supported data types include:
To test uploading CSV lists, you can download a sample CSV file of IP address ranges or copy the following into a file:
list-test.csvcsvvalue,description
192.0.2.0/24,This is an IP address range in CIDR format
198.51.100.0/24,This is also an IP address range
203.0.113.0/24,This is the third IP address range
When you format a CSV file for upload:
To upload the list to the Cloudflare dashboard:
Add the following permission to your cloudflare_api_token :
Zero Trust WriteDecode the contents of the CSV file and store it as a local value:
locals {
ip_list = csvdecode(file("${path.module}/list-test.csv"))
}
Create a list using the cloudflare_zero_trust_list resource:
resource "cloudflare_zero_trust_list" "ips_from_csv" {
account_id = var.cloudflare_account_id
name = "IPs imported from CSV"
description = "Managed by Terraform"
type = "IP"
items = local.ip_list
}
You can now use this list in the policy builder by choosing the in list operator.
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/lists" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"description": "Private application IPs",
"items": [
{
"value": "10.226.0.177/32"
},
{
"value": "10.226.1.177/32"
}
],
"name": "Corporate IP list",
"type": "IP"
}'Add the following permission to your cloudflare_api_token :
Zero Trust WriteCreate a list using the cloudflare_zero_trust_list resource.
Example list of IPs:
resource "cloudflare_zero_trust_list" "wiki_IPs" {
account_id = var.cloudflare_account_id
name = "Company Wiki IP addresses"
description = "Managed by Terraform"
type = "IP"
items = [
{
description = "Example IP address range"
value = "192.0.2.0/24",
},
{
value = "198.51.100.0/24"
}
]
}
Example list of domains:
resource "cloudflare_zero_trust_list" "wiki_domains" {
account_id = var.cloudflare_account_id
name = "Company Wiki Domains"
description = "Managed by Terraform"
type = "DOMAIN"
items = [
{
value = "wiki.example.com"
},
{
value = "wiki2.example.com"
}]
}
You can now use this list in the policy builder by choosing the in list operator.
In the Lists page, locate the list you want to edit.
Select Edit. This will allow you to:
Once you have edited your list, select Save.
Your lists can include up to 1,000 entries for Standard plans and 5,000 for Enterprise plans. An uploaded CSV file must be smaller than 2 MB.
Hostname lists do not support wildcard entries (*.example.com). You will need to add domains as exact matches. Adding a wildcard to lists comprised of hostnames will return an error when you save.
Gateway supports non-Latin characters by converting all domains and hostnames to Punycode . Once you save a list with non-Latin characters, Gateway will display the entry as Punycode.
Lists cannot have duplicate entries. Because domains and hostnames are converted to Punycode, multiple list entries that convert to the same string will count as duplicates. For example, xmple.com converts to xnxmple-rqa5d.com, so including both xmple.com and xnxmple-rqa5d.com in a list will result in a duplicate error.
Gateway ignores trailing forward slashes (/) in URLs. For example, https://example.com and https://example.com/ will count as the same URL and may return a duplicate error.
Extended email addresses (also known as plus addresses) are variants of an existing email address with + or . modifiers. Many email providers, such as Gmail and Outlook, deliver emails intended for an extended address to its original address. For example, providers will deliver emails sent to contact+123@example.com or con.tact@example.com to contact@example.com.
By default, Gateway will either filter only exact matches or all extended variants depending on the type of policy and action used:
DNS policies
| Action | Behavior |
|---|---|
| Allow | Match exact address only |
| Block | Match exact address and all variants |
| Override | Match exact address and all variants |
| Safe Search | Match exact address and all variants |
| YouTube Restricted | Match exact address and all variants |
Network policies
| Action | Behavior |
|---|---|
| Allow | Match exact address only |
| Audit SSH | Match exact address and all variants |
| Block | Match exact address and all variants |
| Network Override | Match exact address only |
HTTP policies
| Action | Behavior |
|---|---|
| Allow | Match exact address only |
| Block | Match exact address and all variants |
| Do Not Inspect | Match exact address only |
| Do Not Isolate | Match exact address only |
| Do Not Scan | Match exact address only |
| Isolate | Match exact address and all variants |
Other policies
| Policy type | Behavior |
|---|---|
| Egress policy | Match exact address only |
| Resolver policy | Match exact address only |
To force Gateway to match all email address variants, go to Traffic policies > Traffic settings > Policy settings and turn on Match extended email addresses. This setting applies to all firewall, egress, and resolver policies.
You can send 600 requests to the Gateway Lists endpoint per minute. If you exceed the rate limit, Cloudflare will block subsequent requests for 120 seconds.
| Web Proxy Viewer | New URL | Original Page |