Document updated on Oct 25, 2022
The GeoIP integration allows you load Maxmind’s GeoIP2 City database (both commercial and free versions) and enrich all KrakenD calls to your backends with geo data.
To add GeoIP information to your backends, copy the Maxmind’s database file into the filesystem (it has to be a city DB) and specify its location in the configuration. Downloading the database requires signing up to MaxMind’s website.
Download the commercial or free GeoIP2 City
Add the following extra_config
in the root to your configuration file:
{
"version": 3,
"plugin": {
"pattern":".so",
"folder": "/opt/krakend/plugins/"
},
"extra_config": {
"plugin/http-server": {
"name": ["geoip", "another-plugin-maybe" ],
"geoip": {
"citydb_path": "/etc/krakend/GeoIP2-City.mmdb"
}
}
}
}
| The path in the filesystem containing the database in GeoIP2 Binary (.mmdb ) format. Relative to the working dir or absolute path.Example: "path/to/GeoIP2-City.mmdb" |
When the GeoIP plugin is enabled, all requests to the backend are enriched with a header X-GeoIP
.
The following structure is available. Keys that couldn’t retrieve its associated data show an empty value. You can use these fields in the GeoIP policies.
City
GeoNameID
integerNames
map[string]stringContinent
Code
stringGeoNameID
integerNames
map[string]stringCountry
GeoNameID
integerIsInEuropeanUnion
boolIsoCode
stringNames
map[string]stringLocation
AccuracyRadius
integer16Latitude
float64Longitude
float64MetroCode
integerTimeZone
stringPostal
Code
stringRegisteredCountry
GeoNameID
integerIsInEuropeanUnion
boolIsoCode
stringNames
map[string]stringRepresentedCountry
GeoNameID
integerIsInEuropeanUnion
boolIsoCode
stringNames
map[string]stringType
stringSubdivisions
(array):GeoNameID
integerIsoCode
stringNames
map[string]stringTraits
IsAnonymousProxy
boolIsSatelliteProvider
boolThe documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.