-
Notifications
You must be signed in to change notification settings - Fork 86
fix: set undefined ODB 404 TTLs to 60 seconds #1647
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
Conversation
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-hp-edge-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-canary ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-i18next-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-edge-middleware ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-rsc-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for nextjs-plugin-custom-routes-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
167b94c
to
b6d5e6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it and it works great!
Summary
This PR fixes a bug that causes 404 responses to be cached indefinitely by ODB functions, meaning that once an ODB route returns a 404 it can never be invalidated by a subsequent 200 response.
The bug occurred because Next Server sends standard cache control headers (SWR, max-age one year) for a 404 response, even if the URL is an ISR route which would otherwise (for a 200 response) send headers with a max age equal to the revalidate value. This means that our handler function was not adding a TTL to the builder function when an ISR page returned a 404.
Standard 404 pages on non-ISR routes will be routed to the standard non-ODB handler function and will therefore bypass the logic in this PR, which should only apply to ISR routes that conditionally return a
notFound: true
ingetStaticProps
.Test plan
Visit
/getStaticProps/with-revalidate-404/
on the demo site deploy preview and observe that the page should 404 if the last digit of the current minute is 0-4 and should show a successful 200 response if the last digit is 5-9.Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
Closes netlify/pod-ecosystem-frameworks#246