The log importer and the usercountry:attribute command currently do not work with geoip2 server modules, since they require geolocating specific IP addresses, rather than the current one. However, it's possible to "trick" the server module into geolocating any ip address, by sending a request to the server with the X-Forwarded-For
header. We can use this to make log importing & the usercountry:attribute
geolocate with the server module.
Possible implementations:
usercountry:attribute
: for this command we would simply send a http request to localhost server side w/ X-Forwarded-For
set.cip
is set and is different from MMDB_ADDR
. Not sure if this would have a large impact on performance.The endpoint used to return back geoip data should be minimal. Like a php file that simply return $_SERVER[...]
vars. We don't want to make a another request to Piwik during tracking.