Kiloserve Proxy Hosting

Quality & Custom Proxy Hosting

Kiloserve Proxy Hosting header image 2

How to block specific countries from accessing your proxy

November 1st, 2007 · 10 Comments

Blocking traffic to your proxy from specific countries is debatable. We are supposed to offer a way out to people who are blocked behind filtering software (college students, people in countries under oppressed regimes) while at the same time, we need to pay off our expenses and make some profit as well.

Based on my personal experience, the only traffic that I found as abusive is Chinese. China provided for 20% of my proxy visits yet it used 80% of bandwidth. I am not sure what they viewing through proxies but that’s a bit too much.

There are a few options to block countries:

  1. GeoLite Country from MaxMind: a comprehensive solutionwhich includes scripts and IP database which you’ll need to integrate with your proxy. This is not the easiest way to do it but if you feel comfortable then it’s an efficient way of blocking specific traffic
  2. Using .htaccess: the easiest way to do this in my opinion. Go to blockacountry.com and follow the easy instructions there. You’ll get a .htaccess file which you’ll need to upload to your root directory of your proxy. This is not the most efficient way of blocking traffic but it does the job.
  3. Using iptables file: you can do this if you have a dedicated server running apache. You basically edit this file to enter all IP’s you want to block. You can get the IP’s from either the IP database provided by MaxMind or from the list of IPs you get in .htaccess by following method 2 above. Alternatively use the blacklist tool from LinuxAdmin

Tags: block traffic

10 responses so far ↓

  • 1 John // Dec 6, 2007 at 11:23 pm

    Awesome post! The ability to block specific countries from accessing your proxy is very useful. Not only does it help prevent misuse of your proxy, reduce bandwidth costs, and keep y0ur server’s resource usage lower, but most of the companies that are serving ads on your proxy site are going to pay next to nothing for clicks and/or impressions from these foreign countries.

  • 2 stevie // Mar 17, 2008 at 8:26 am

    I use .htaccess using blockacountry.com.

    I was wondering can you not do the same thing via cPanel if you have it installed or is this not the same?

  • 3 admin // Mar 17, 2008 at 8:44 am

    Do you mean if you have cPanel installed?
    I am not sure since at Kiloserve we use H-Sphere but I would doubt that cPanel has an in-built functionality to block specific countries.

  • 4 stevie // Mar 17, 2008 at 11:15 am

    I’m new to cPanel and was just browsing the control panel.

    cPanel has

    ‘IP Deny Manager’
    This feature will allow you to block a range of IP addresses to prevent them from accessing your site. You can also enter a fully qualified domain name, and the IP Deny Manager will attempt to resolve it to an IP address for you.

    ******

    I just wondered if it could do the same thing as a .htaccess file though I wouldn’t want to have to input all the ip ranges.

  • 5 admin // Mar 17, 2008 at 1:51 pm

    Then you could try getting the list of IPs from the htaccess for the countries you want to block and enter them there. Not sure if it converts that to htaccess though

  • 6 stevie // Mar 17, 2008 at 11:53 pm

    I tested it out on cPanel by adding an ip range to deny, checked the .htaccess file and the ip range I added was there.

    Pasting ip’s into the .htaccess file would still be the best way if using this method I think.

    If you’re going to block a lot of countries does that not slow your site? having to trawl through a long list, is this where GeoLite Country would be quicker?

  • 7 admin // Mar 17, 2008 at 11:56 pm

    Stevie, definitely true but GeoLite is much more difficult to implement. Imagine having 10 or more proxy sites….
    In any case, I don’t think you need to block more than 1 or 2 countries so it shouldn’t create a problem

  • 8 stevie // Mar 18, 2008 at 2:03 pm

    Yes I tried to install it today and gave up. Though at the moment my hosting provider is doing a really good job of blocking EVERY country by being down for the last few days.
    One interesting thing I read about GeoLite is how easy it can be to target different countries and regions with specific ads. Something that’s quite important with some advertisers these days.

  • 9 admin // Mar 18, 2008 at 10:48 pm

    It might be important for some advertisers but I don’t think it’s that important for a proxy site. In the end you have to weigh the cost (your time and efforts), versus the benefit i.e. the advertising money you’ll bring in. Will it make such a big difference if you have geo-targeted ads?
    Not sure if it’s worth it…

  • 10 stevie // Mar 20, 2008 at 12:49 am

    Yes I agree with you on the that, it’s not worth the effort for a proxy site.

Leave a Comment