How to stop proxy servers

They have: 3 posts

Joined: Sep 2010

Is there anyway to stop people from accessing a website using proxy servers ?

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Usually, the browser will send an "HTTP_X_FORWARDED_FOR" header when a proxy is used. In PHP, that will show up in the $_SERVER["HTTP_X_FORWARDED_FOR"] variable. I believe this there is a way to use a proxy without sending this header, but it may be a place to start.

The only other thing I can think of is blacklisting some known proxies.

They have: 6 posts

Joined: Feb 2011


As a guy who wrote a proxy HTTP content filtering system last year. Don't ask me why it was a mad moment when I thought it could turn into a cool product.

The headers a proxy passes like HTTP_X_FORWARDED_FOR are entirely up to the proxies discretion whether they included or not. However pr0g4mm3r is correct that will probably detect a lot of them.

If the proxies are coming from a certain ip address you could probably block that ip address in cpanel but that would be almost impossible as there are many proxies.

This might be more accurate but it will probably still not be fool proof and there is a danger of false positives.

function isProxy()
return ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_X_FORWARDED'] || $_SERVER['HTTP_FORWARDED_FOR'] || $_SERVER['HTTP_CLIENT_IP'] || $_SERVER['HTTP_VIA'] || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554)) || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30));

They have: 7 posts

Joined: Mar 2011

HTTP protocol through a proxy server stop. If you do not want to buy software, there is another way. You can insert a script in your site root htsaccess file. It is best to copy and paste the code, not type.

They have: 7 posts

Joined: Mar 2011

You can block proxy server using some proxy software on your server and also using some IP address analyzing tools or software.

They have: 5 posts

Joined: May 2011

Lot of work but you can look up the IP number of the proxy and block that IP in your .htaccess file. You can block entire countries or an entire IP range the same way.

C0ldf1re's picture

They have: 20 posts

Joined: May 2011

jacob2012 wrote:
... You can block entire countries or an entire IP range the same way.

Yes. Blocking out the Phillipines and Nigeria is always a good start.

They have: 3 posts

Joined: Jul 2011

this is no way to force a proxy to honor your caching request, they are only
hints. if the proxyserver is ignoring the no-cache, url decoration is a
common way to invaldate the cache.


just tack a new randowm number on every page request. (you will need to use
client code to rewrite the postback url if you are using's postback
model). a filter could also do the work.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.