maxmind / mod_maxminddb

MaxMind DB Apache Module
https://maxmind.github.io/mod_maxminddb/
Apache License 2.0
125 stars 28 forks source link

Library using private IP and not public IP to determine location #72

Closed riddhish-mandaliya closed 5 years ago

riddhish-mandaliya commented 5 years ago

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.

  1. Followed all the steps and installed mod_maxminddb from here. https://github.com/maxmind/mod_maxminddb

  2. Added below code in .htaccess to enable MaxMind apache module.

MaxMindDBEnable On MaxMindDBFile CITY_DB //GeoIP2-City.mmdb MaxMindDBEnv MM_COUNTRY_CODE CITY_DB/country/iso_code MaxMindDBEnv MM_STATE_CODE CITY_DB/subdivisions/0/iso_code

  1. 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?

nchelluri commented 5 years ago

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!