Home/ The SEO and GEO Guide/ Guide
- Edge code changes the HTML or headers in flight, so crawlers see the fix even though the CMS has not changed.
- It is ideal for redirects at scale, header changes, well-known files and fixes a platform will not let you make.
- Changes made at the edge are invisible in the CMS, so document them and keep the code in version control.
- Test the served output with URL Inspection and curl, not the CMS preview.
- Treat it as a bridge or a scalpel, not a permanent replacement for fixing the platform.
Edge SEO is the practice of implementing SEO changes in the content delivery network that sits in front of a website, rather than in the CMS or on the origin server. Small serverless functions run on the CDN's servers and can rewrite requests and responses: issue redirects, change headers, edit HTML and serve files. Search engines and AI crawlers receive the modified version, exactly as users do.
Why teams use it
- Locked platforms: site builders and SaaS platforms often will not let you upload files, add headers or manage redirects in bulk.
- Slow release cycles: a fix stuck in a development backlog for months can go live at the edge in days.
- Legacy stacks: old systems that nobody wants to touch.
- Migrations: handling thousands of redirects consistently, in one place.
- Testing: splitting groups of pages to test title or markup changes.
Common uses
- Redirect maps and rules, including trailing slash, case and protocol normalisation.
- Adding or correcting canonical, hreflang and meta robots tags.
- Injecting or fixing structured data.
- Setting HTTP headers: X-Robots-Tag, Link, security headers, cache control.
- Serving robots.txt, llms.txt, sitemaps and /.well-known/ files such as assetlinks.json.
- Returning correct 404 or 410 status codes where the platform serves soft 404s.
- Removing unwanted parameters before they reach the cache.
The main tools
- Cloudflare Workers, with the HTMLRewriter API for streaming HTML edits. Cloudflare also has no-code Redirect Rules, Transform Rules and Bulk Redirects for simpler jobs.
- Akamai EdgeWorkers.
- Fastly Compute.
- AWS CloudFront Functions and Lambda@Edge.
- Vercel and Netlify edge middleware for sites hosted there.
A simple Cloudflare Worker example
export default {
async fetch(request) {
const url = new URL(request.url);
if (url.pathname === "/old-guide") {
return Response.redirect("https://www.example.com/seo-guide/redirects", 301);
}
const response = await fetch(request);
return new HTMLRewriter()
.on("head", {
element(el) {
el.append('<link rel="canonical" href="' + url.origin + url.pathname + '">', { html: true });
}
})
.transform(response);
}
};
This redirects one URL and adds a self-referencing canonical to every HTML page. In practice you would first check the page does not already have one, and only run the rewrite on HTML responses.
Risks and trade-offs
- Invisible changes: editors see one thing in the CMS while crawlers see another. Months later, nobody remembers why.
- Conflicts: the platform adds a tag later and you end up with two canonicals.
- Single point of failure: a bug in edge code can break every page at once.
- Performance and cost: heavy HTML rewriting adds latency, and requests are metered.
- Ownership: SEO teams writing production code need the same review process as developers.
- Cloaking risk: serving different content to bots and users is against search engine guidelines. Edge changes should apply to everyone.
Governance checklist
- Keep edge code in version control with clear comments.
- Maintain a register of every edge change and why it exists.
- Use a staging route or zone before production.
- Log and monitor errors and response times.
- Schedule a review to move permanent fixes back into the platform where possible.
How to test
- URL Inspection in Search Console shows the HTML Google actually received.
- curl -I and view source confirm headers and tags at the edge.
- A crawl checks the change across every affected template.
- Log files confirm crawlers are getting the right status codes.
The GEO angle
Most AI crawlers do not run JavaScript, so fixes added with a tag manager are invisible to them. Edge changes land in the raw HTML, which means canonicals, structured data and content corrections reach AI crawlers too. The edge is also where AI bot access is decided, so Edge SEO and AI visibility increasingly sit with the same team.
Related guides
