Files
caddy-waf/docs/geoblocking.md
2025-10-14 22:20:02 +03:00

827 B

🌍 Country Blocking and Whitelisting

  • Uses the MaxMind GeoIP2 database for country lookups.
  • Download the GeoLite2-Country.mmdb file (see Installation).
  • Use block_countries or whitelist_countries with ISO country codes:

Priorities

Whitelisting has a higher priority than Blacklisting.

Config Example

Whitelist: BR
Blacklist: US, UK

Q: Which is THE priority ?
A: BR IPs are allowed, all others are blocked

Global blocking priorities

  • IP blacklist
  • DNS blacklist
  • Rate limit
  • Whitelist
  • Blacklist

Config example

# Block requests from Russia, China, and North Korea
block_countries /path/to/GeoLite2-Country.mmdb RU CN KP

# Whitelist requests from the United States
whitelist_countries /path/to/GeoLite2-Country.mmdb US