Zone Lockdown (3)
Last updated Aug 14, 2026 Zone Lockdown specifies a list of one or more IP addresses, CIDR ranges, or networks that are the only IPs allowed to access a domain, subdomain, or URL. You can configure multiple destinations, including IPv4/IPv6 addresses, in a single zone lockdown rule.
All IP addresses not specified in the zone lockdown rule will not have access to the specified resources. Requests from those IP addresses will receive an Access Denied response.
Note
Cloudflare recommends that you use custom rules instead of zone lockdown rules to block requests from IP addresses not present in an allowlist of IPs and CIDR ranges.
For examples of using custom rules for this purpose, refer to the following use cases:
Availability
Cloudflare Zone Lockdown is available on paid plans. The Zone lockdown rules option appears only if you have configured at least one zone lockdown rule.
The number of available zone lockdown rules depends on your Cloudflare plan.
| Free | Pro | Business | Enterprise | |
|---|---|---|---|---|
| Availability | No | Yes | Yes | Yes |
| Number of rules | 0 | 3 | 10 | 200 |
Create a zone lockdown rule
Note
The Zone lockdown rules option appears only if you have configured at least one zone lockdown rule.
If you have access to Zone Lockdown rules
- In the Cloudflare dashboard, go to the Security rules page. Go to Security rules ↗
- Select Create rule > Zone lockdown rules.
If this option is not available, refer to the instructions below. - Enter a descriptive name for the rule in Name.
- For URLs, enter the domains, subdomains, or URLs you wish to protect from unauthorized IPs. You can use wildcards such as
*. Enter one item per line. - For IP Range, enter one or more allowed IPv4/IPv6 addresses or CIDR ranges, one per line. Only these IP addresses and ranges will be able to access the resources you entered in URLs.
- (Optional) If you are creating a zone lockdown rule that overlaps with an existing rule, expand Advanced Options and enter a priority for the rule in Priority. The lower the number, the higher the priority. Higher priority rules take precedence.
- Select Save and Deploy lockdown rule.
If you do not have access to Zone Lockdown rules
Create a custom rule to perform zone lockdown:
- In the Cloudflare dashboard, go to the Security rules page. Go to Security rules ↗
- Select Templates, and then select the template Allow only specified IP addresses.
- Fill in the required fields and select Deploy.
Issue a POST request for the Create a Zone Lockdown rule operation similar to the following:
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Firewall Services Write</code>
</details>
Create a Zone Lockdown rulebash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/firewall/lockdowns" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"description": "Block all traffic to staging and wiki unless it comes from HQ or branch offices",
"urls": [
"staging.example.com/*",
"example.com/wiki/*"
],
"configurations": [
{
"target": "ip_range",
"value": "192.0.2.0/24"
},
{
"target": "ip_range",
"value": "2001:DB8::/64"
},
{
"target": "ip",
"value": "203.0.133.1"
}
]
}'
Example rule
The following example rule will only allow visitors connecting from a company’s headquarters or branch offices to access the staging environment and the wiki:
- Name:
txt
Block all traffic to staging and wiki unless it comes from HQ or branch offices
- URLs:
txt
staging.example.com/*
example.com/wiki/*
- IP Range:
txt
192.0.2.0/24
2001:DB8::/64
203.0.133.1
This example would not protect an internal wiki located on a different directory path such as example.com/internal/wiki.
Note
A custom rule with an equivalent behavior would have the following configuration:
Description:
Block all traffic to staging and wiki unless it comes from HQ or branch offices
Expression:
((http.host eq "staging.example.com") or (http.host eq "example.com" and http.request.uri.path wildcard "/wiki/*")) and not ip.src in {192.0.2.0/24 2001:DB8::/64 203.0.133.1}
Action: Block
Access denied example
A visitor from an unauthorized IP will get the following error when there is a match for a zone lockdown rule:

Related resources
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/tools/zone-lockdown/#page","headline":"Zone Lockdown","description":"Restrict access to specific URLs by allowlisted IP addresses.","url":"https://developers.cloudflare.com/waf/tools/zone-lockdown/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/tools/zone-lockdown/og.png?v=9c6be6c901c5968f","dateModified":"2026-08-14","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: Configure WAF settings at the account level for multiple zones. title: Account-level WAF configuration image: https://developers.cloudflare.com/waf/account/og.png?v=32a83b453b7b7c30
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.
