demo · v136

Server-side routing

The chromestatus motivation: a page has multiple parties (CDN, framework, page) installing speculation rules. Their requests should be routable / billable / cacheable differently. v136 lets each rule set carry a tag, sent in the Sec-Speculation-Tags header. This concept simulates the receiving end — an edge worker that branches on tag.

Installs three tagged rule sets and prints the headers they would each send.

three rule sets, three tags

CDN preload

{ "prerender": [{ "urls": ["/products"], "tag": "cdn:akamai" }] }

framework router

{ "prerender": [{ "urls": ["/about", "/pricing"], "tag": "next:link-prefetch" }] }

page-level a/b test

{ "prerender": [{ "urls": ["/v2/landing"], "tag": "experiment:landing-v2" }] }

edge-worker decision (simulated)

function onRequest({ headers }) { const tags = (headers.get("Sec-Speculation-Tags") || "").split(",").map(s => s.trim()); if (tags.includes("cdn:akamai")) return cacheFor(86400); if (tags.startsWith("experiment:")) return passthrough(); // never cache experiments if (tags.includes("next:link-prefetch")) return cacheFor(60); return cacheFor(0); }
last simulated request
worker verdict

why this angle

The sibling concept shows what installing a tagged rule looks like in the browser. This concept is the opposite end of the wire: the edge worker that has to decide whether a speculative request should be cached for a day, served from a different bucket, or refused entirely. Without tags, the only signal was the URL itself.

see also