Banning most free proxies with htaccess or with a software?

Husbarn

Junior Member
Joined
Dec 19, 2012
Messages
160
Reaction score
20
What do you think is better?

Does adding thousands of ips to a htaccess file adds a big "weight" on your resources?
 
I use some PHP code very similar to whats shared on link above ^ . Does good job blocking free proxy sites.
 
Use MaxMind's free/paid GeoIP and php, you can achieve this very easy without adding thousands ips to htaccess which would be out of mind.

And use php + mysql for banning single ips that you don't like. I can write the script for you quickly if you need it.
 
Blocking thousands of IPs with htaccess will have a negative impact on your site's loading speed. Better consider blocking some HTTP protocols proxies use with htaccess like the guy describes here: http://perishablepress.com/block-tough-proxies/.

The first option mentioned out there is not very smart in some ways (it was even mentioned in the comments out there), but the second option (.htaccess) looks good.

So if I add this code to my .htaccess file:

Code:
<ifModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP:VIA}                 !^$ [OR]
 RewriteCond %{HTTP:FORWARDED}           !^$ [OR]
 RewriteCond %{HTTP:USERAGENT_VIA}       !^$ [OR]
 RewriteCond %{HTTP:X_FORWARDED_FOR}     !^$ [OR]
 RewriteCond %{HTTP:PROXY_CONNECTION}    !^$ [OR]
 RewriteCond %{HTTP:XPROXY_CONNECTION}   !^$ [OR]
 RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
 RewriteCond %{HTTP:HTTP_CLIENT_IP}      !^$
 RewriteRule .* - [F]
</ifModule>

It will block free proxies? Can it cause some problems with real visitors (without proxies) and block them too?
 
I think that would work for some %.
Anyway I'd go with code and GeoIP and block Anonymous Proxy country and avoid .htaccess when ever possible because code gives you more control and navigating folder level deeper still causes httpd to look at the parent folder for .htaccess file contents. Meaning if you visit /rootfolder/subfolder/ apache will query httaccess in both /rootfolder/ and /rootfolder/subfolder/ as Sgt Kraut mentioned, performance matters.

Depending on complexity of your case, maybe applying this htaccess trick will be just enough.

I'd also suggest to redirect the traffic somewhere instead of showing a forbidden page.

Best wishes.
 
Just tried that htaccess method and it's poor. Only blocks the weakest proxies.

PHP method given out there is no good too, because it can block a lot of real visitors without proxies.

I need a method which could block elite and high anonymous proxies.
 
There is a really good php script that auto loads problem ip's, bots and proxies in your .htaccess file found here: myip.ms
 
There are plugins out there ie. Spider Spanker that can accomplish this too
 
Back
Top