The question in everyone’s mind in 2017 is how is the internet going to change internationally since the introduction of the Digital Economies bill in the UK. We have started to see the reality of these changes with Femdomvideos announcing they will begin blocking all UK visitors next week (1st January) unless they are paid subscribers. UK visitors will be directed to a page explaining that they no longer directly access they web site without using a VPN. So the question is what are you going to do?
There is no doubt that other web sites out there will also introduce the same solution to this as frankly its the easiest to implement. Blocking IP addresses based on a country is a pretty trivial problem for your host to set up and redirecting to another page is a few lines of code. There is however performance issues with larger sites to deal with. For example to block UK IP addresses from a site will take a htaccess file of roughly 70,000 lines which is going to slow your website down – Imagine, every single request to load a page, image or script has to go through those 70K lines first before loading the entire page. Doing this method is easy but will be expensive on server resources.
Your host could block a country at firewall level by altering the routing tables and adding some new rules; several thousand lines but this would take the pressure off your web server/site but load extra pressure on the hosts firewall set-up to protect your web server. If you have a dedicated or Virtual Private Server (VPS) then the host would probably allow this but it would be a small nightmare to keep the IP ranges in the table to update since they would have to be manually done. Anything manual is my least favourite solution. You can get IP ranges for a country from http://ipdeny.com/ipblocks/ for your information.
My preferred solution when handling it on the web server would be to ask the host to install “Mod_Security” and “GEOIP2” which are Apache modules that runs on the server and then you can have a few lines added to your htaccess file which will block a country. The problem here is some hosts may not be too keen on setting something like up if their architecture makes it awkward or just don’t have the expertise to do it. This method is entirely depend on your host and how much technical support you get.
The most user friendly is to use an outside domain proxy service like Cloud Flare which acts like an additional security layer that exists between your domain name and web host. Blocking a country is as easy as selecting it from a drop down list and applying the change. Cloud Flare has a free plan for small to medium sites and a $20 one that would be suitable for most pay sites out there. Cloud Flare also protects web sites from DoS attacks and those that try to hack web sites.
To set up the cloud flare service, simply create an account, click the add website button to add a site and type in your domain. It will scan your DNS records for a couple of minutes before displaying the results, just click continue here and then select the “Free” or $20 a month plan. Then you will be asked to change the name servers on your domain registrar from your current hosts to the Cloud Flare ones. These changes take roughly 24 hours to propagate and there won’t be any downtime at all as the switch is made. However if you wish to customise the Challenge page (you will) that UK visitors will get then the $20 plan is the only way to go.
Having said that, I probably wouldn’t use CloudFlare myself but use a host based solution has its literally less than 6 lines of code to block a country, saving myself $20 a month.