Skip to content

rfc: Use header provided by proxy to determine user country & location #461

@elavol

Description

@elavol

Dupe Check

Describe the solution you'd like?

Many proxies (CloudFront, Cloudflare...etc) already added headers which provide user location info and usually more accurate than lookup location via IP address. So IMO allow config to use these headers to determine user location is more efficient, and it also faster (since just need to read header). And fallback to use ip lookup if headers is omit.

Example

// Current code
const ip = getIPFromHeaders(headers) || reqIP || ''
const { country, city, region } = getGeoDetails(ip)

// New
let { ip, location } = getClientRequestInfo(headers);

if (!location) {
   location = getGeoDetails(ip);
}

Additional context

No response

How important is this feature to you?

3

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions