X-Nextjs-Stale-Time

The HTTP X-Nextjs-Stale-Time response header is an unofficial header added by Next.js to control how long prefetched page data remains fresh in the browser's client-side Router Cache.

Note

The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and needs to be transitioned to the formal naming convention for HTTP headers.

Usage

Next.js introduced the X-Nextjs-Stale-Time header to give developers control over the client-side Router Cache. The Router Cache stores prefetched route data in the browser, making client-side navigations between pages feel instant. This header tells the Next.js client runtime how many seconds the cached route data remains usable before the framework revalidates from the server.

The value works alongside the server-side Caching configuration. While Cache-Control governs HTTP-level caching at CDNs and browsers, X-Nextjs-Stale-Time is specific to the Next.js in-memory Router Cache. A page with a 300-second stale time keeps its prefetched data in the client for five minutes. After five minutes, the next navigation to the same route triggers a fresh fetch.

Setting the value to 0 disables the Router Cache stale window entirely, forcing the client to revalidate on every navigation. The staleTimes configuration in next.config.js controls what value Next.js sends in this header. The staleTimes configuration controls the stale window duration. The default stale time for dynamic pages is 0 seconds.

Values

The value is a number representing seconds.

Numeric seconds

A positive integer sets the stale window in seconds. The most common value observed in production is 300 (five minutes), which is the Next.js default for static pages.

0

A value of 0 disables the Router Cache stale time. Every client-side navigation triggers a fresh server request for the route data.

Large values

Some configurations use large numbers (like 4294967294) to effectively keep the Router Cache valid indefinitely. This is functionally equivalent to disabling client-side revalidation.

Example

The default configuration sends a stale time of 300 seconds (five minutes). Prefetched route data stays valid in the browser's Router Cache for this duration before the next navigation triggers a revalidation.

X-Nextjs-Stale-Time: 300

A shorter stale time of 60 seconds keeps the client-side cache fresh for one minute. This is common for pages with frequently changing content.

X-Nextjs-Stale-Time: 60

On a Vercel deployment, the header appears alongside X-Nextjs-Cache and X-Vercel-Cache, covering both client-side and server-side Caching layers.

X-Nextjs-Stale-Time: 300
X-Nextjs-Cache: HIT
X-Vercel-Cache: HIT

Takeaway

The X-Nextjs-Stale-Time response header controls the duration in seconds the Next.js client-side Router Cache treats prefetched page data as fresh before revalidating from the server.

See also

Last updated: March 6, 2026