tim-bezhashvyly/geoip — pull request #6 by ProxiBlue (2013-12-13 02:42:16+00:00)
Title: Usage of $_SERVER['REMOTE_ADDR'] will not work on servers behind a reverse proxy

$_SERVER['REMOTE_ADDR'] will not contain the actual IP of the client accessing the site, but that of any behind a reverse proxy sitting front-facing

Using a call to Mage::helper('core/http')->getRemoteAddr() instead will produce the correct, expected results, if the required directive were set in the sites config.xml to correctly populate remote_addr

as an example:

HTTP_X_REAL_IP
HTTP_X_FORWARDED_FOR

Additionally, no check is done that REMOTE_ADDR array key was in fact existing.
This would throw an error: Undefined index: REMOTE_ADDR in /app/code/community/Openstream/GeoIP/Model/Country.php on line 12

This can happen when a cron job is causing the GEOIP code to run. - This happens in magento EE send_notifications cron job.