When used behind Haproxy, piwigo logs haproxy ip address as visitors source ip address instead of visitors real ip address.  This was described in piwigo forum by docofchaos in september 2016.  Docofchaos also proposed a fix : 

edit functions.inc.php in /usr/local/www/apache24/includes:

comment $ip =  $_SERVER['REMOTE_ADDR'];

and insert

  if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  } else {
        $ip =  $_SERVER['REMOTE_ADDR'];
  }

This fixed the problem for me in piwigo 14.2.0 (freebsd implementation)
piwigo "historique" records haproxy ip address instead of visitors source ip address
This is a GitHub Issue
repo:Piwigo
owner:Piwigo
Title : piwigo "historique" records haproxy ip address instead of visitors source ip address
Issue date:

--- start body ---
When used behind Haproxy, piwigo logs haproxy ip address as visitors source ip address instead of visitors real ip address.  This was described in piwigo forum by docofchaos in september 2016.  Docofchaos also proposed a fix : 

edit functions.inc.php in /usr/local/www/apache24/includes:

comment $ip =  $_SERVER['REMOTE_ADDR'];

and insert

  if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  } else {
        $ip =  $_SERVER['REMOTE_ADDR'];
  }

This fixed the problem for me in piwigo 14.2.0 (freebsd implementation)
--- end body ---
