v2.4.2

geo

Public GeoIP lookup endpoints for country and city-level detection.

FieldValue
Serverless servicedrive-api-geo
Runtimenodejs22.x, arm64
Regionap-southeast-2
Deployed HTTP operations2
Local worker harnesses0
OpenAPI/openapi/geo.yaml · interactive

Deployed routes

MethodPathAuthSummary
GET/geo/countryPublicCaller country from CloudFront viewer header
GET/geo/cityPublicCity-level GeoIP lookup (MaxMind)

Behaviour notes

  • /geo/country reads the CloudFront-Viewer-Country header and returns {country}; missing header returns {}.
  • /geo/city resolves IP from ip, X-Forwarded-For, or API Gateway sourceIp, then looks up MaxMind city data.
  • Local/private IPv4 ranges are rejected with 400.
  • The city route returns state, city, postcode, latitude, longitude, accuracy radius, and timezone when MaxMind data is available.

Source map

  • services/geo/serverless.yml
  • services/geo/functions/geoDetectionCountry.ts
  • services/geo/functions/geoDetectionCity.ts
  • data/GeoLite2-City/
Esc