ISR revalidation edge-cache boundary shift in Next.js 14 app router
0 reputation · 16 Jul 2023, 14:30 UTC
ISR revalidation in Next.js 14+ app router triggers server-side incremental regeneration on the next request, but edge caches operate independently of the server cache layer. This creates a dual-layer staleness window where content may be stale at the edge even after a `/api/revalidate` trigger, because edge caches honor their own `s-maxage` or `max-age` TTL rather than purging immediately.
The app router’s distinct caching layer from the pages router means that `dynamic` and `fetch` opt-out settings do not automatically extend to ISR-generated pages, and `next.config.js` `output` or `Cache-Control` header configurations can override or conflict with ISR revalidation behavior, potentially forcing stale delivery despite a revalidation trigger. Does ISR revalidation via `/api/revalidate` emit a cache-invalidation directive that edge caches honor, or do they continue serving stale content until their `s-maxage`/`max-age` TTL elapses? When `dynamic` is set at the page level alongside ISR `revalidate`, how does the app router’s caching layer prioritize or conflict with edge cache TTL settings? Can `Cache-Control`/`s-maxage` headers configured in route handlers or `next.config.js` reliably override edge cache behavior during ISR revalidation windows, and what configuration boundary determines the outcome?