IP and country rules

Allow or block single addresses, CIDR ranges and countries at the edge, for a whole zone or only for some of its names.

On this page

IP and country rules are edge rules of kind ip and geo. They apply in every WAF mode, before rate limits and the WAF.

IP rules

FieldValue
ipAn IPv4 or IPv6 address (203.0.113.7, 2001:db8::1) or a CIDR range (203.0.113.0/24, 2001:db8::/32). Stored in canonical form.
actionblock: answer 403. allow: skip threat feeds and country rules for this address.

An allow rule does not skip rate limits, the WAF, the shields or AI Crawl Control. Avoid overlapping rules with different actions for the same address.

Country rules

FieldValue
country_codeISO 3166-1 alpha-2 code, e.g. RU. Stored in upper case.
actionblock: answer 403 to visitors from that country. allow: never block that country with a country rule.

A country rule only acts on the country it names: an allow rule does not block the other countries. To keep a site to a few countries, add block rules for the countries you don't want. Visitors whose country can't be determined are never blocked by a country rule.

Add a rule

Domain → Security → Firewall → Rules: IP rules → Add IP rule or Countries → Add country rule. Choose the Action, optionally the names it Applies to, and a Note.

Blocked requests appear in security events as IP Rule or Geo Block.

Last updated:

↑↓ to navigate↵ to openesc to close