Next.js Discord

Discord Forum

Need to skip client cache for router.push

Unanswered
Southern rough shrimp posted this in #help-forum
Open in Discord
Southern rough shrimpOP
Hello! I am working on a solution to redirect users to a specific page by skipping client cache. We are leveraging Nginx, not Node.

So far I've explored rewrites with a 301 status code in next.config.js, but that is only supported by Node.

I've also looked into router.push(url, undefined, { unstable_skipClientCache: true}); but this unstable solution is bothering our team.

The last solution I explored was:

router.replace({
pathname: '/[whatever]',
query: { param_key: param_value },
}).then(() => router.reload())

But this forced reload is also not the most ideal situation. They all seem very hacky.

Does anyone have a solution to redirect users to the latest page by skipping client cache?

Thanks for your time!

2 Replies

aside from using this unstable flag, running reload after push/replace, or using the window prop do manage url... i can't think of anything better
note that i don't know much about this flag as i haven't used it