New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support of server GEOIP headers when after reverse proxy #13121
Comments
In case someone doesn't want to download and extract the patch file: --- plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php.old 2018-07-01 18:49:31.401744139 +0300
+++ plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php 2018-07-01 18:42:21.977012029 +0300
@@ -26,25 +26,25 @@
{
const ID = 'geoip_serverbased';
const TITLE = 'GeoIP Legacy (%s)';
- const TEST_SERVER_VAR = 'GEOIP_ADDR';
- const TEST_SERVER_VAR_ALT = 'GEOIP_COUNTRY_CODE';
- const TEST_SERVER_VAR_ALT_IPV6 = 'GEOIP_COUNTRY_CODE_V6';
+ const TEST_SERVER_VAR = 'HTTP_GEOIP_ADDR';
+ const TEST_SERVER_VAR_ALT = 'HTTP_GEOIP_COUNTRY_CODE';
+ const TEST_SERVER_VAR_ALT_IPV6 = 'HTTP_GEOIP_COUNTRY_CODE_V6';
private static $geoIpServerVars = array(
- parent::COUNTRY_CODE_KEY => 'GEOIP_COUNTRY_CODE',
- parent::COUNTRY_NAME_KEY => 'GEOIP_COUNTRY_NAME',
- parent::REGION_CODE_KEY => 'GEOIP_REGION',
- parent::REGION_NAME_KEY => 'GEOIP_REGION_NAME',
- parent::AREA_CODE_KEY => 'GEOIP_AREA_CODE',
- parent::LATITUDE_KEY => 'GEOIP_LATITUDE',
- parent::LONGITUDE_KEY => 'GEOIP_LONGITUDE',
- parent::POSTAL_CODE_KEY => 'GEOIP_POSTAL_CODE',
+ parent::COUNTRY_CODE_KEY => 'HTTP_GEOIP_COUNTRY_CODE',
+ parent::COUNTRY_NAME_KEY => 'HTTP_GEOIP_COUNTRY_NAME',
+ parent::REGION_CODE_KEY => 'HTTP_GEOIP_REGION',
+ parent::REGION_NAME_KEY => 'HTTP_GEOIP_REGION_NAME',
+ parent::AREA_CODE_KEY => 'HTTP_GEOIP_AREA_CODE',
+ parent::LATITUDE_KEY => 'HTTP_GEOIP_LATITUDE',
+ parent::LONGITUDE_KEY => 'HTTP_GEOIP_LONGITUDE',
+ parent::POSTAL_CODE_KEY => 'HTTP_GEOIP_POSTAL_CODE',
);
private static $geoIpUtfServerVars = array(
- parent::CITY_NAME_KEY => 'GEOIP_CITY',
- parent::ISP_KEY => 'GEOIP_ISP',
- parent::ORG_KEY => 'GEOIP_ORGANIZATION',
+ parent::CITY_NAME_KEY => 'HTTP_GEOIP_CITY',
+ parent::ISP_KEY => 'HTTP_GEOIP_ISP',
+ parent::ORG_KEY => 'HTTP_GEOIP_ORGANIZATION',
);
/**
@@ -232,7 +232,7 @@
$geoipServerVars = array();
foreach ($_SERVER as $key => $value) {
- if (strpos($key, 'GEOIP') === 0) {
+ if (strpos($key, 'HTTP_GEOIP') === 0) {
$geoipServerVars[] = $key;
}
} |
@iprok GeoIP (Legacy) has been deprecated, so I guess we won't change the behavior for this anymore. |
I use geoip2 on my proxy and I just fake variable names because I thought matomo doesn't support geoip2 variable names. Where can I find information about it? I have latest matomo installed. |
you need to enable the geoip2 plugin, but this will trigger an update on the log tables, so for bigger databases this might take a bit longer... |
Hello!
I make IP->geo resolving on nginx reverse proxy. So geoip headers come to matomo with HTTP_ prefix. Can you add support of such situation to matomo please? For now I manually patched the code. Path attached.
geoip-proxy.patch.gz
The text was updated successfully, but these errors were encountered: