GeoIP header injection
This example configures an .mmdb database, and maps some of its attributes to custom headers such as country, city, and latitude. It enables location-aware behavior in downstream services.
In the example below, for instance,
- the
X-Geo-Countryheader will be populated with thecountry.iso_codeattribute provided by the database (the ISO code of the country) - the
X-Geo-Cityheader will be populated with thecity.names.enattribute (the city name in its English version) - the
X-Geo-Latitudeheader will be populated with thelocation.latitudeattribute present in the database
If the .mmdb database you use exposes data with a different organization or naming, you just need to adapt the property paths to retrieve them correctly.
Once the geolocation headers have been added to the request, you can use them to create a geographical redirect rule using the "header" trigger.