Block traffic by geographical location

Last updated May 5, 2026 This example custom rule blocks requests by autonomous system number (ASN), continent, or country of origin.

  • When incoming requests match:
Field Operator Value Logic
AS Num equals 131279 Or
Continent equals Asia Or
Country equals Korea, North

If you are using the expression editor:
(ip.src.asnum eq 131279) or (ip.src.continent eq "AS") or (ip.src.country eq "KP") - Then take action: Block

Other resources

Was this helpful?

YesNo

On this page

Block traffic by geographical location - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-by-geographical-location/#page","headline":"Block traffic by geographical location","description":"Block traffic based on geographic location.","url":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-by-geographical-location/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-by-geographical-location/og.png?v=f612818530d01734","dateModified":"2026-05-05","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["Geolocation"]}


description: Block Microsoft Exchange Autodiscover requests. title: Block Microsoft Exchange Autodiscover requests image: https://developers.cloudflare.com/waf/custom-rules/use-cases/block-ms-exchange-autodiscover/og.png?v=82c0f2be52702d57


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/waf/llms.txt
Use this file to discover all available pages before exploring further.