Hard Navigation Loop with CDN Cache when self-hosting Next.js #70558
Unanswered
haapti
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Next.js has a feature where Next.js will automatically reload the application to retrieve new assets when detected. For example, if there is a mismatch in the deploymentId, transitions between pages will perform a hard navigation versus using soft navigation.
This seems to only affect apps using the Next.js app directory, where it detects an old version via RSC payloads during page navigation.
If you have a CDN in front of your Next.js app and deploy a new build, you might encounter a "hard navigation loop," where the page refreshes on every navigation until the CDN cache is cleared. This happens because the initial HTML document is outdated, causing a version mismatch with the RSC payload (what is using the cache buster ?_rsc=xxx).
Has anyone else faced this issue? Or do you only use CDNs for static assets, relying on Next.js's internal cache for the rest?
Beta Was this translation helpful? Give feedback.
All reactions