Library using private IP and not public IP to determine location
riddhish-mandaliya opened this issue · 1 comments
Facing issue with GeoIP legacy database lookup. MMDB_ADDR always uses private IP and not the public IP address to determine location of IP.
Here are the steps we followed.
-
Followed all the steps and installed mod_maxminddb from here.
https://github.com/maxmind/mod_maxminddb -
Added below code in .htaccess to enable MaxMind apache module.
MaxMindDBEnable On
MaxMindDBFile CITY_DB /<path_to_db>/GeoIP2-City.mmdb
MaxMindDBEnv MM_COUNTRY_CODE CITY_DB/country/iso_code
MaxMindDBEnv MM_STATE_CODE CITY_DB/subdivisions/0/iso_code
- Trying to read MMDB_ADDR like this in PHP script.
echo $_SERVER['MMDB_ADDR'];
This is printing private IP "10.0.0.84"
while public IP address is "52.42.80.12".
Because of this not getting anything in MM_COUNTRY_CODE and MM_STATE_CODE.
I believe it must use public IP address so that location of user can be determined.
Can you please help me out on this and tell me where I'm going wrong or anything specific I need to update on server?
Hello,
It seems like your webserver is probably behind a proxy/load balancer frontend. If you look at the Usage section of the README, we suggest using mod_remoteip to fix this issue. Good luck!