0

I'm creating an app with Laravel on Nginx and I would like to be able to tell if a user is using a proxy. Check must be on PHP, no JS or other only PHP.

On Apache I not have a problem, just using $_SERVER with:

$proxy_headers = array(
    'HTTP_VIA',
    'HTTP_X_FORWARDED_FOR',
    'HTTP_FORWARDED_FOR',
    'HTTP_X_FORWARDED',
    'HTTP_FORWARDED',
    'HTTP_CLIENT_IP',
    'HTTP_FORWARDED_FOR_IP',
    'VIA',
    'X_FORWARDED_FOR',
    'FORWARDED_FOR',
    'X_FORWARDED',
    'FORWARDED',
    'CLIENT_IP',
    'FORWARDED_FOR_IP',
    'HTTP_PROXY_CONNECTION'
);
foreach($proxy_headers as $x){
    if (isset($_SERVER[$x])) die("You are using a proxy!");
}

But on Nginx I have a problem? Headers do not send 'HTTP FORWARD'. Any Help?

Laky
  • 745
  • 2
  • 12
  • 25
  • Why are you interested if the user is using a proxy? There is no safe way of telling this. It's all up to what the proxy server used is willing to share in their request to your server. – Björn Fyrvall Oct 19 '16 at 15:35
  • Proxy is one of the items (other is JS, jQuery, IMAGES enabling on user side) which I use to detect botnet – Laky Oct 19 '16 at 15:42
  • 1
    I'm guessing you've already looked at this question http://stackoverflow.com/questions/858357/detect-clients-with-proxy-servers-via-php since that seems to have the same example code your showing us. Basically your best bet if you want to be sure to catch all proxies is to use a paid service to check inbound IP address against a know proxy list. – Mark Davidson Oct 19 '16 at 15:44

0 Answers0