Frameworks can now add afterCacheBypass rules that serve or bypass a cached page based on headers from the request, the cached response, or both.
Bypass rules are set through the Build Output API, which frameworks can use to produce a Vercel deployment with platform features like Vercel Functions, routing, and caching.
{ "version": 3, "afterCacheBypass": [ { "name": "HTML Limited Bots", "hasAll": [ { "type": "request.header", "key": "user-agent", "value": { "re": "Bingbot|Discordbot|Slackbot|Twitterbot|WhatsApp" } }, { "type": "cache.response.header", "key": "x-has-head-metadata", "value": { "eq": "0" } } ] } ]}Bypass the cache for HTML-limited bots when the cached page is missing metadata
Vercel checks the rules in order. If a rule matches, Vercel bypasses the cache and invokes the function, and the response is served with x-vercel-cache: BYPASS. If no rule matches, Vercel serves the cached page. Rules apply only to prerendered pages, not API routes or server-rendered pages.
Next.js is the first framework to use these rules. Previously, on partially prerendered pages, Next.js bypassed the cache for every request from HTML-limited bots such as Bingbot and Slackbot. These bots need complete <head> metadata, and Next.js could not tell whether the cached page included it. Next.js 16.5 bypasses only when the metadata is missing, with no configuration beyond upgrading. On nextjs.org, over 70% of those requests are now cache hits.
Read the afterCacheBypass documentation to configure your first rule.