Disabling cache write for non-existent pages
Unanswered
Citrus blackfly parasitoid posted this in #help-forum
Citrus blackfly parasitoidOP
Hey! I have Next 12.3.1 application and I'm using getStaticProps in a [[...slug]] catch all file. When the request is sent to my app, I try to fetch the data from CMS, when it gives me
Is there a way to disable caching the non existent slugs? Or maybe like redirecting to the /not-found page instead just the usual "slug stays the same and the 404 page is shown" when returning
undefined, it means the page doesn't exist in my CMS. Therefore I return { notFound: true }. The problem I'm facing is I think the fact that the slug is different, next tries to cache the 404 page under new slug. Lately I've been getting bot spams (the usual looking for wordpress vulnerabilities) and it caused my data cache writes to be up 650k units in just under an hour. At least that's what I think caused the data cache writes usage. I'm 2 days into my billing period and the cache writes are over a million, so my 50%..Is there a way to disable caching the non existent slugs? Or maybe like redirecting to the /not-found page instead just the usual "slug stays the same and the 404 page is shown" when returning
{ notFound: true } from getStaticProps