PDA

View Full Version : Block 99% Of Proxy Servers



anthonyparsons
Mon 12th Oct '09, 3:40am
I was just going through some site updates and found the rewrite conditions I use to block 99% of proxies. It works, and for anyone who wants to take out proxy users without attempting to run thousands of domains or IP's, then feel free to use this if you desire. I do not remember where I got this from, but its not my own and I did get it from another site over a year ago. You may need to test this, it may not be right for you and your setup. I know anyone who uses Frontpage... it will likely cause you an issue. Not sure why anyone does use FrontPage... but no doubts some do. :rolleyes:

So instead of trying to takeout proxy servers by who they are, it is far more efficient to take them out by what they do, being the various HTTP protocols they employ.


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]

May be useful to those trying to reduce spammers upon their sites who surf anonymously (as they typically do).

Eidolon
Mon 12th Oct '09, 4:57am
Thanks for sharing this:), this looks like Perishable's idea: http://perishablepress.com/press/2008/04/20/how-to-block-proxy-servers-via-htaccess/

The idea of blocking all proxies causes me a little concern, some people who surf my site use proxies, not necessarily because they want to be malicious but because they wish to protect their privacy. Just thought it would help some people to point out that it is not 'always' a great idea to block proxies.;)

anthonyparsons
Mon 12th Oct '09, 5:41am
Thats the one Eidolon... nice find. I looked for this thing earlier when posting, but couldn't find it. That is the place I got it from last year.

Carnage-
Mon 12th Oct '09, 8:06am
Some ISP's put all their web traffic through proxies as well... Cant remember the name but there was a small UK isp i had this issue with. It even changed clients ip's mid session which was playing havok with my session hijacking protection.

My uni also for a while used a web proxy.