How to prevent Next.js from caching 404 responses? #79497
Unanswered
tietoville
asked this question in
Help
Replies: 2 comments 1 reply
-
I am rushing this answer, but if you throw an error, while rendering, instead of Because, like, semantically, what you are doing is saying, well this article/item, is no longer available, rather than, revalidation failed. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi @tietoville I tried last canary version and is working correctly, could be fixed by #79512 (?) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
We're using Next.js 15 with the App Router and have run into a caching issue related to dynamic routes, and maybe ISR.
On certain dynamic routes, like /places/[id] we use:
export const revalidate = 300; export const dynamic = 'force-static';
Also, on layout levels we use
generateStaticParams()
.Each place page fetches data from our internal API. Occasionally, this API is temporarily down (e.g., for maintenance). When that happens:
Even after the API is back up:
Currently we work around this problem by manually redeploying the app. I have just today started to investigate this issue, and I've understood there could be an alternate workaround using the
revalidatePath()
. However, we would prefer just not to cache the 404 responses. Is that possible?Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions