IP Geolocation Filter

This filter decorates HTTP requests with the geolocation data. Filter uses client address to lookup information (eg client’s city, country) in the geolocation provider database. Upon a successful lookup request will be enriched with the configured geolocation header and value from the database. In case the configured geolocation headers are present in the incoming request, they will be overriden by the filter. Geolocation filter emits stats for the number of successful lookups and the number of total lookups.

Configuration

  • This filter should be configured with the type URL type.googleapis.com/envoy.extensions.filters.http.geoip.v3.Geoip.

  • v3 API reference

Statistics

Geolocation filter outputs statistics in the http.<stat_prefix>.geoip.<geo-header-name>. namespace. The stat prefix comes from the owning HTTP connection manager.

Name

Type

Description

.hit

Counter

Number of successful lookups within geolocation database for a configured geolocation header.

.total

Counter

Number of total lookups within geolocation database for a configured geolocation header.

Configuration example

name: envoy.filters.http.geoip
typed_config:
  "@type": type.googleapis.com/envoy.extensions.filters.http.geoip.v3.Geoip
  use_xff: true
  xff_num_trusted_hops: 1
  geo_headers_to_add:
    country: "x-geo-country"
    region: "x-geo-region"
  provider:
      name: "envoy.geoip_providers.maxmind"