Prompt

How do I run redirects at the edge for a global website?

Technology / CDN & Edge Infrastructure2 observationsLast seen Nov 8, 2026

Latest observation

Nov 8, 2026OpenAI APIWeb search: off

To run redirects at the edge for a global website, you typically want the redirect logic to happen on a CDN or edge platform close to the user, rather than on your origin server. That gives you faster responses, lower origin load, and more consistent behavior worldwide.

Common ways to do it

1. Use your CDN’s built-in redirects

Many CDN providers support redirect rules directly in their control plane.

Examples:

  • Cloudflare: Bulk Redirects, Redirect Rules, Workers
  • Akamai: Edge Redirector / Property Manager rules
  • Fastly: Edge Dictionaries + VCL, or Compute
  • AWS CloudFront: Functions or Lambda@Edge
  • Netlify / Vercel: Redirect config files or edge routing features

Best for:

  • Simple permanent or temporary redirects
  • Large redirect maps
  • Minimal custom logic

2. Use edge functions

If redirects depend on request data like:

  • country / locale
  • device type
  • cookie / session
  • path patterns
  • A/B testing or experiment buckets

then use an edge function or edge worker.

Typical flow:

  1. Request arrives at nearest edge location
  2. Edge code checks redirect rules
  3. If matched, return 301, 302, 307, or 308
  4. If not matched, proxy to origin

3. Store redirect rules in edge-friendly storage

For large-scale global redirect sets, don’t hardcode every rule in the function if the list is big or changes often.

Use:

  • edge key-value store
  • distributed config store
  • CDN redirect table
  • static redirect manifest generated during deployment

This lets you update redirects without redeploying code.

Recommended architecture

For a global website, a practical pattern is:

  • CDN in front of everything
  • Redirect logic at edge
  • Origin only handles requests that are not redirected

Example decision order:

  1. Exact legacy URL match
  2. Locale/country redirect
  3. Canonical host/scheme redirect
  4. Other app routing to origin

Things to watch out for

Use the right HTTP status code

  • 301: permanent redirect
  • 302: temporary redirect
  • 307: temporary, preserves method
  • 308: permanent, preserves method

For SEO and site migrations, 301 or 308 are usually preferred.

Prevent redirect loops

Always check:

  • current host
  • current path
  • whether the destination is already the same as the request
  • trailing slash normalization

Keep redirects deterministic

At the edge, redirects should be:

  • fast
  • cacheable where possible
  • consistent across regions

Handle localization carefully

If you redirect by country or language:

  • respect user-selected locale cookies
  • avoid overriding explicit URLs
  • provide a way to switch back
  • consider SEO hreflang/canonical tags

Test globally

Verify from multiple geographies:

  • North America
  • Europe
  • Asia-Pacific
  • mobile and desktop
  • different protocols and hosts

Example logic

Pseudo-code:

if (request.host === "old.example.com") {
  return redirect("https://www.example.com", 301);
}

if (request.path === "/pricing-old") {
  return redirect("/pricing", 301);
}

if (country === "FR" && !hasLocaleCookie) {
  return redirect("/fr" + request.path, 302);
}

return fetchOrigin();

When edge redirects are a good fit

Use edge redirects when:

  • you need low latency globally
  • redirects are based on location or request metadata
  • you have a migration with many old URLs
  • you want to reduce origin traffic

When not to use them

Avoid edge redirects if:

  • logic depends on heavy backend data
  • you need complex session state
  • redirects are highly dynamic and personalized beyond edge capabilities

If you want, I can give you:

  1. a Cloudflare Worker example,
  2. an AWS CloudFront/Lambda@Edge example, or
  3. a platform-agnostic redirect architecture for your site.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.