Click-through rate is a noisy proxy for relevance, but at scale it becomes a behavioral signal that search systems can learn from.
Cloudflare Workers sit in the request path before origin, which makes them a sharp place to fix a familiar SEO failure mode: the cache key and the crawler’s expectations diverge. Most sites want one HTML response per URL, but client-rendered routes, geo variants, and origin logic that sniffs User-Agent can produce a different DOM for Googlebot than for a human. Slapping `Vary: User-Agent` on the response is usually the wrong move; it fragments cache at the CDN and still leaves intermediaries guessing. Workers let you make the partition explicit, narrow, and auditable.
The pattern starts with a custom cache key. Instead of letting the default key collapse all requests to `/pricing` into one object, normalize the request into a bot class and append that class to an internal cache URL, not to the user-visible canonical. A verified Googlebot request for `/pricing` might map to an internal key like `/pricing?__cf_bot=google`, while a human request maps to `__cf_bot=human`. Fetch the origin with the original URL and headers, then put the response into `caches.default` under the synthetic key. The browser never sees the synthetic query. The canonical remains `/pricing`. The cache object is partitioned by intent rather than by the full entropy of the UA string.
The bot class must come from verified signals, not a substring match on “Googlebot”. A random curl with a spoofed UA should not earn its own cache slot or a prerendered fallback. Use the `cf.botManagement` object where the plan exposes it, check `verifiedBot`, score, and bot category, and keep an allowlist of search and render services. For everyone else, default to the human cache class. That default keeps cache hit ratio sane and avoids an attacker filling the edge with poisoned bot variants. If bot management is unavailable, fall back to a conservative allowlist plus origin-side verification, and accept that some crawler traffic will share the human cache object. Correctness beats cache purity.
Where this earns its keep is rendering parity. Suppose an SPA serves a skeleton to humans and relies on Google’s renderer to execute JavaScript. That works, but it wastes crawl budget and makes status, canonical, and hreflang harder to guarantee. A Worker can detect verified crawlers and proxy a prerender service or an origin HTML fallback, then use `HTMLRewriter` to enforce canonical tags, meta robots directives, and structured data without touching the main app. The human response stays the SPA. The crawler response is a stable HTML document with the same content model and no cloaking. Keep the fallback content materially equivalent, because edge SEO is still SEO; if the crawler sees a different offer, the tactic becomes a liability.
The same Worker can normalize status codes and headers at the edge. A migration may leave origin throwing 200s with soft-404 copy, or redirect chains that Googlebot discovers late. The Worker can inspect the response, rewrite a soft-404 to 404 when a route config says so, collapse double slashes, and add `Cache-Control: public, s-maxage=...` for cacheable HTML. Keep redirect logic in Workers KV so route changes ship without a deploy, but version the config and log decisions. Edge rewrites are powerful and opaque if nobody can explain why a URL returned 410 on Tuesday. Keep the rules close to the route table, not buried in a string of conditionals.
Operationally, instrument the partition. Emit cache hit ratio by bot class, origin latency, fallback rate, and `HTMLRewriter` mutation counts to Workers Analytics Engine or your log sink. Watch for cache growth from synthetic keys and cap TTLs on bot variants. Use `ctx.waitUntil` for async logging so the response stream is not held open. Run canary URLs through both classes and diff rendered HTML, status, canonical, and robots directives. The goal is not to build a separate crawler site at the edge; it is to make the cache key match the rendering contract, then prove the contract holds.



