Dev.to
7/22/2026

Understanding Next.js Page Caching (with a real example)
Short summary
Next.js App Router sets s-maxage=31536000 (one year) on statically prerendered pages, causing listing pages to appear stale while dynamic article pages update immediately. The fix is adding `export const revalidate = 60` to the route file for time-based ISR, or calling `revalidatePath('/writing')` for on-demand invalidation after content saves. Browser cache headers and Nginx settings do not override edge caching — the correct place to control freshness is in the Next.js route itself.
- •Next.js sets s-maxage of one year on prerendered pages, causing stale listing pages
- •Add `export const revalidate = 60` for time-based ISR, or `revalidatePath()` for instant updates
- •Edge caching is controlled in the Next.js route, not via browser or server headers
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



