piwigo "historique" records haproxy ip address instead of visitors source ip address #1833

Open
opened 2026-10-05 00:58:11 +02:00 by adam · 0 comments
Owner

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)

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) <!-- github-sync-id:2116522641 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1833