Log X-Real-IP only when it's different than REMOTE_ADDR

pull/7091/head
Aleksander Machniak 5 years ago
parent 3b3dd0cf7a
commit e3c6989494

@ -658,7 +658,7 @@ class rcube_utils
$address = $_SERVER['REMOTE_ADDR']; $address = $_SERVER['REMOTE_ADDR'];
// append the NGINX X-Real-IP header, if set // append the NGINX X-Real-IP header, if set
if (!empty($_SERVER['HTTP_X_REAL_IP'])) { if (!empty($_SERVER['HTTP_X_REAL_IP']) && $_SERVER['HTTP_X_REAL_IP'] != $address) {
$remote_ip[] = 'X-Real-IP: ' . $_SERVER['HTTP_X_REAL_IP']; $remote_ip[] = 'X-Real-IP: ' . $_SERVER['HTTP_X_REAL_IP'];
} }
@ -668,7 +668,7 @@ class rcube_utils
} }
if (!empty($remote_ip)) { if (!empty($remote_ip)) {
$address .= '(' . implode(',', $remote_ip) . ')'; $address .= ' (' . implode(',', $remote_ip) . ')';
} }
return $address; return $address;

Loading…
Cancel
Save