-
Notifications
You must be signed in to change notification settings - Fork 26.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is Middleware need to be cached? #65956
Comments
Btw, it can be a pain with Auth. Using the next/prev btns can lead to still display a cached protected page after logout. |
Hi -- the behavior you're observing relates to the client router cache. If you'd like to disable the client router cache so that every request hits the server, you can disable it by modifying your /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
staleTimes: {
dynamic: 0,
},
},
}
module.exports = nextConfig You can learn more about this configuration option here. |
thats cool, i will try it |
Already saw this, but it didn't resolve all my issues related to this "Lazy" middleware behavior. :/ Maybe I will open an issue for that. /shrug |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/LowScarlet/portfolio-api/tree/main/frontend/website
To Reproduce
Home1/page.tsx
Home2/page.tsx
Recording_2024-05-19_185352.mp4
20240519-1700-45.9373681.mp4
Current vs. Expected behavior
The middleware should still run every time the page changes
Provide environment information
Which area(s) are affected? (Select all that apply)
Middleware
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Its work if we use random query, you can check the last video (So the point is middleware has been cached)
The text was updated successfully, but these errors were encountered: