Next.js Discord

Discord Forum

How to disable static caching of 404s?

Unanswered
Philippine Crocodile posted this in #help-forum
Open in Discord
Philippine CrocodileOP
With Next.js v14 is there a way to prevent Next.js from creating static files for 404s in .next/server/app? There is constant crawler/pen test/junk traffic coming through on any public domain and Next.js creates a static file for all requests just to serve up a cached 404 response. There does not appear to be any way to configure Next.js to not create these files without hacky middleware. These files grew to 1gb in size in less than a month.

Has anyone else tackled this issue?

0 Replies