Prompt
How do I personalize content by location using edge compute?
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
You can personalize content by location at the edge by doing a very fast geolocation lookup near the user, then selecting or rewriting content before it reaches the browser/app.
Common pattern
- Request hits the edge
- CDN, edge worker, or edge function receives the request.
- Detect location
- Use IP geolocation data available at the edge, or a trusted header from your CDN.
- Sometimes combine with user-provided location or browser geolocation if you need higher accuracy.
- Choose content
- Route to a region-specific page, pick a locale, currency, language, store inventory, legal notice, or promo.
- Return personalized response
- Either:
- serve a cached variant, or
- rewrite HTML/JSON dynamically, or
- redirect to a localized URL.
- Either:
Example use cases
- Show prices in local currency
- Display nearest store or service area
- Apply local language and formatting
- Show region-specific promotions
- Enforce compliance messages by country/state
Implementation options
- Edge middleware / edge functions: inspect request metadata and modify response.
- CDN cache key variation: cache separate versions by country/region.
- Geo headers: many CDNs add headers like country, region, city.
- A/B or rule engine at edge: use location as an input to decisioning.
Best practices
- Prefer coarse location first
- Country-level is usually enough and more privacy-friendly.
- Avoid over-personalizing from IP alone
- IP geolocation can be inaccurate, especially on mobile/VPNs.
- Cache carefully
- Vary only on the dimension you need, like country, to avoid cache explosion.
- Have fallbacks
- Default content if location is unknown.
- Respect privacy and consent
- Be transparent if you use location for personalization.
- Use explicit user overrides
- Let users manually change country/language/currency.
Simple flow
- User from France requests homepage.
- Edge detects
country=FR. - Edge returns French homepage, euro pricing, EU shipping info.
- Same URL can still be cached separately for France and other countries.
If you want a concrete implementation
Tell me your platform, for example:
- Cloudflare Workers
- Fastly Compute
- Akamai EdgeWorkers
- AWS CloudFront Functions / Lambda@Edge
- Vercel Edge Middleware
- Netlify Edge Functions
I can give you a ready-to-use example for that stack.