Skip to content
Cloudflare Docs

Allow traffic from specific countries only

This example custom rule blocks requests based on country code using the ip.src.country field, only allowing requests from two countries: United States and Mexico.

  • Expression: (not ip.src.country in {"US" "MX"})
  • Action: Block

Other resources