Prompt

How do I handle redirects and header changes at the edge?

Technology / CDN & Edge Infrastructure1 observationLast seen Oct 26, 2026

Latest observation

Oct 26, 2026OpenAI APIWeb search: off

Handling redirects and header changes at the edge usually means using a CDN, reverse proxy, or edge platform to make routing decisions before traffic reaches your origin.

Common patterns

1) Redirects

Use edge logic when you want to:

  • move old URLs to new ones
  • enforce HTTPS
  • normalize hostnames
  • do geo/device-based routing

Typical redirect types:

  • 301: permanent
  • 302: temporary
  • 307/308: preserve HTTP method and body

2) Header manipulation

At the edge you can:

  • add security headers
  • rewrite Host
  • set caching headers
  • strip sensitive headers
  • inject geo/user-agent info into upstream requests
  • control CORS behavior

Where this is done

Depends on your platform:

  • CDNs: Cloudflare, Fastly, Akamai, CloudFront
  • Reverse proxies: Nginx, Envoy, HAProxy
  • Edge runtimes: Cloudflare Workers, Vercel Edge Functions, Netlify Edge Functions

Examples

Nginx

server {
    listen 80;
    server_name example.com;

    return 301 https://www.example.com$request_uri;
}

location / {
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Request-Id $request_id;
    add_header X-Frame-Options DENY;
}

Cloudflare Worker

export default {
  async fetch(request) {
    const url = new URL(request.url);

    if (url.pathname === "/old") {
      return Response.redirect("https://example.com/new", 301);
    }

    const headers = new Headers(request.headers);
    headers.set("X-Edge-Added", "true");
    headers.delete("Authorization");

    return fetch(new Request(request, { headers }));
  }
}

Best practices

  • Prefer 301/308 for permanent moves
  • Avoid redirect chains
  • Keep header changes minimal and explicit
  • Preserve X-Forwarded-For, X-Forwarded-Proto, and request IDs
  • Test cache behavior carefully
  • Make sure security headers aren’t overwritten later by origin responses

Key question

The exact method depends on your edge platform. If you tell me which one you’re using, I can give you a precise config or code example.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation 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.