A Next.js page can look correct after a hard refresh and show the wrong result when reached from a link. Those requests may ask for different representations of the same route. Treat the framework’s response headers and routing behavior as part of the deployment contract.

Keep hashed build output available

Start with the production build’s immutable assets. Deploy its files before new HTML begins referencing them, and retain the previous release’s files through the transition. A returning visitor may still have an old document open when the next navigation tries to import a chunk.

Give rendered routes their own policy

Inspect the deployed version’s headers for a static route, an ISR route, a dynamic account page and Draft Mode. Honor private responses and the framework’s cache variation. An external edge can keep a previous public response after Next.js has regenerated its copy. Coordinate edge expiry or invalidation with the application’s publishing requirement.

Exercise a cross-release navigation

Open an earlier deployment in one tab. Deploy the new version, navigate within the app, reload the resulting URL, and open it in a clean signed-out session. Check for chunk failures, mismatched React payloads and private data. If route variation cannot be represented safely at the edge, limit shared caching to assets while investigating.

Sources & further reading

Reader questions

Does revalidating a Next.js path automatically purge a separate CDN?

It depends on the integration. Verify the new revision through the delivery hostname after triggering revalidation and configure CDN invalidation where the application needs it.