[]previous and next page

geoOf

The geo a platform reported for a request.

The geo a platform reported for a request. Cloudflare reads request.cf; Vercel reads its x-vercel-ip-* headers (the city percent-encoded); Netlify reads the x-nf-geo JSON. Anything missing or malformed is undefined.

Import#

ts
import { geoOf } from "@shadow-js/dusk/server";

Signature#

ts
function geoOf(request: Request, platform: GeoPlatform): GeoInfo

Parameters#

Name Description
request The request as the platform passed it.
platform The platform whose entry is running.

Returns#

The geo, every field undefined when absent.

Examples#

ts
geoOf(request, "vercel").country; // "FR" when the x-vercel-ip-country header says so