[ Web Proxy ]
URL:
Viewing: https://developers.cloudflare.com/waf/custom-rules/use-cases/block-traffic-from-specific-countries/ [Back]  [Original]

Block traffic from specific countries Cloudflare Web Application Firewall (WAF) docsSkip to content
SearchCtrlKLog in
  1. Home
  2. /WAF
  3. /
  4. /Common use cases
  5. /Block traffic from specific countries

Block traffic from specific countries

Last updated May 5, 2026Copy as MarkdownView as MarkdownAgent setup
OverviewOther resources

This example custom rule blocks requests based on country code using the ip.src.country field.

  • When incoming requests match:

    Field Operator Value
    Country is in Korea, North, Syria

    If you are using the expression editor:
    (ip.src.country in {"KP" "SY"})

  • Then take action: Block

Other resources

PreviousBlock traffic by geographical locationNextBuild a sequence rule within custom rules

Was this helpful?

YesNo
Edit pageReport issue
[]

Web Proxy Viewer  |  New URL  |  Original Page