mirror of
https://github.com/fabriziosalmi/caddy-waf.git
synced 2025-12-23 22:27:46 -05:00
827 B
827 B
🌍 Country Blocking and Whitelisting
- Uses the MaxMind GeoIP2 database for country lookups.
- Download the
GeoLite2-Country.mmdbfile (see Installation). - Use
block_countriesorwhitelist_countrieswith 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