Hello developers,
I noticed that subscribers IPs are not returned correctly using $SERVER['REMOTE_ADDR'] if the website uses CloudFlare (this instruction returns the IP of the CloudFlare nearest mirror of the website).
Fortunately, CloudFlare adds two headers with the original subscriber IP: $SERVER['HTTP_X_FORWARDED_FOR'] and $SERVER['HTTP_CF_CONNECTING_IP'] (and $SERVER['HTTP_TRUE_CLIENT_IP'] if it's the CF Enterprise paid plan).
$SERVER['REMOTE_ADDR'] is used in a few files in AcyMailing.
A remedy to this would be a conditional fallback on which header can be used, something like
if (isset($_SERVER['HTTP_TRUE_CLIENT_IP'])) $ip = $_SERVER['HTTP_TRUE_CLIENT_IP']; # CloudFlare specific header for enterprise paid plan, compatible with other vendors
elseif (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; # another CloudFlare specific header available in all plans, including the free one
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; # specific header for proxies put by CF
elseif (isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR']; # this one would be used, if no header of the above is present