Every website owner has to decide on the best way to optimize speed and accessibility. Sometimes those two goals push in opposing directions. Filtering your traffic based on the country is a legit tactic, despite some people trying to shame you into doing otherwise. If you think you can improve your website performance or reduce spam by blocking a country, then, by all means, go for it. Don’t listen to those who try and convert your site into a moral crusade. Your site is a business, and you should treat it as such. Here’s how to block countries in both QUIC.cloud and Cloudflare.
Blocking Countries via IP Ranges Isn’t Easy
The old way of blocking countries was by maintaining country-based IP lists and filtering them on your server. Not only is this unwieldy, it transfers the burden of detecting and blocking the country to your server. This additional load can bring your website to its knees if you’re facing a flood of spam attacks from a certain region.
Fortunately, by using reverse proxies like Cloudflare and QUIC.cloud, you can easily block entire countries without messy IP lists and without burdening your website.
Blocking Countries in QUIC.cloud
QUIC.cloud is a reverse proxy brought to you by the same team behind the LiteSpeed web server. It’s relatively new compared to its more mature cousin – Cloudflare. But it’s a bit more user-friendly and has in-built settings, whereas Cloudflare is more platform agnostic. It’s specially designed to work with WordPress by integrating the LiteSpeed caching plugin.
To block countries using QUIC.cloud, log into the dashboard and under “CDN Config”, click “Traffic” as shown here:
This screen lets you set broad options for allowing or blocking entire continents, not just countries. By default, traffic from all continents is allowed. Within each continent, you can click the drop-down box labeled “Exception” and choose individual countries in each continent to either block or allow through like this:
In the above screenshot, I’ve blocked Russia within the continent of Europe (apparently, Russia belongs to both Asia and Europe). You can choose other countries as exceptions in each continent as well. Save your changes, and you’re done. QUIC.cloud will now block or allow countries based on your choices.
I like the interface for country-level access in QUIC.cloud. Here’s how to achieve the same thing in Cloudflare.
How to Block Countries in Cloudflare
To allow or block countries in Cloudflare, log into the dashboard and, under “Security”, click “WAF”. Under “Firewall Rules”, click “Create Firewall Rule” and enter the fields in the next screen as shown here:
Under “Field”, choose “Country,” and under “Operator”, choose “is in”. This will populate a dropdown box for “Value”, and you can choose from the list of countries you want to block. Unlike QUIC.cloud, you don’t need to first choose the continent, though you can also block and allow entire continents. While the QUIC.cloud system is easier to start, I find the Cloudflare methodology more flexible, particularly since the tool is integrated into the general firewall functionality instead of being a separate section.
Save your changes, and you can track the firewall’s effectiveness via the Security Overview dashboard in Cloudflare. You can also choose to have users face a challenge instead of blocking them outright, which is a good compromise between speed and security.
Blocking Countries Has Never Been Easier
I remember a time when it was hard to block entire countries, and there were specialized services that provided IP lists to consult. With reverse-proxies like QUIC.cloud and Cloudflare, you don’t need to worry about this anymore, and you can offload the entire server load to a powerful EDGE network so that your target visitors don’t have to wait for their content to load.!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!