ℹ️ This page contains an example of a configuration file for the redirection.io agent. To discover all the configuration file and its options, please refer to the agent configuration reference. You may also check the list of configuration examples to find a configuration example that is close to your technical context.

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-Country header will be populated with the country.iso_code attribute provided by the database (the ISO code of the country)
  • the X-Geo-City header will be populated with the city.names.en attribute (the city name in its English version)
  • the X-Geo-Latitude header will be populated with the location.latitude attribute 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.