Is it possible to block access to my website for specific country?

June 2, 2015 1.1k views
Configuration Management Security

Are there any settings for docker to block access to my website for specific country?

Or I need to do all programming myself? Is it optimal to create a block in .htaccess?

Or which 3rd party services to use. Preferably free, of course.

2 Answers

Yes. You can use a firewall like iptables to block the IP address blocks associated with a country. This process is not 100% as any users using a VPN outside their country, using a service like TOR or a web proxy outside their country would still be able to access your server since they would not be assigned an IP address associated with their country.

I found this guide that should be helpful.

This references blocking Chinese IPs and the script near the bottom uses a third party service to source the IP lists. These can be found here.

Found a solution - I had Prestashop, and just wanted to block specific country. Appeared it is native setting in Preferences→Geolocation

Have another answer? Share your knowledge.