Country Blocking

Serve the countries you do business in

If your customers are in two countries, there's little reason to let the other two hundred hit your login page. NOC lets you block or challenge chosen countries, or flip it around and allow only the countries you serve, on the whole site or just the pages that matter.

Free 14-Day Trial
No credit card required. Included for every site.
Block a list of countries, or allow only a list
Block, or show a CAPTCHA so real travelers get through
For the whole site, or only chosen paths
Visitor country and network passed to your server, if you want them

Smaller attack surface, less noise

Much of the brute force, card testing and form spam a small business sees comes from countries where it has no customers. Blocking them removes that traffic before it costs you server time, fills your logs or trips your fraud tools.

Geo-blocking is a blunt tool, so NOC gives you a softer edge too: instead of a hard block, visitors from those countries can get a CAPTCHA. Your customer on vacation clicks once and gets in. A botnet does not.

Common setups

Local business

Allow only your own country on the whole site, with a CAPTCHA for everyone else.

Admin lockdown by country

Allow only the countries your team works from on /wp-admin and the login page.

Checkout fraud

Block card-testing traffic from countries you don't ship to, only on the checkout.

Modes and actions

Mode
Block these countries, or allow only these countries. In allow-only mode, every other country gets the action, including visitors whose country can't be determined.
Countries
Two-letter country codes, like RU CN to block, or US CA to allow only the United States and Canada.
Which pages
The whole site, or paths like /wp-login.php, /checkout or /admin.
Action
Block, CAPTCHA, or invisible CAPTCHA.
Country to your server
Optionally, NOC adds NOC-Client-Country and NOC-Client-ASN headers to requests sent to your server, so your application can use them too (Privacy tab).

Automate it with the API

Country rules are custom rules of type country_block.

Block Russia, Iran and North Korea on the whole site
curl "https://my.noc.org/api?apikey=YOUR_API_KEY&action=cdn/customrules/add&website=example.com&rule_type=country_block&url=/&value=RU%20KP%20IR"
Allow only Brazil, with a CAPTCHA for everyone else
curl "https://my.noc.org/api?apikey=YOUR_API_KEY&action=cdn/customrules/add&website=example.com&rule_type=country_block&url=/&value=BR&allow_only=true&block_response=captcha"

Full API reference →

Frequently asked questions

Yes. Verified search engine crawlers are not affected by country rules, wherever they crawl from.

A VPN makes a visitor appear in another country. To handle them too, combine country rules with VPN blocking.

NOC uses the same GeoIP data as Trunc, updated regularly. A small share of addresses have no known country, and in allow-only mode they're treated as not allowed.

Learn the basics: What is geo-blocking? · Blocking IPs with .htaccess

Related features

Security that works, at a price that makes sense

$5per domain per month.

Get access to our full suite of services, including DNS, WAF/CDN and Monitoring, or use only what you need. Our WAF/CDN operates on a distributed anycast network with over 20 data centers, delivering exceptional global performance.

Free 14-Day Trial