Public Directory Next.js Files

Hi! I’m trying to access a JSON file stored in the /public directory in the root of a next.js project. The file is stored under public/cache/posts.json in the source repository.

I can access this file on localhost at localhost:3000/cache/posts.json, but I can’t do the same with my production url (https://harmonious-dragon-7274d2.netlify.app/cache/posts.json).

I downloaded the Netilfy build output and am seeing the cache/posts.json file in the root of the deploy, but don’t exactly know how that maps to the live url.

Thanks for any help provided.

Hey @harrygz,

The cache directory is forced to always return a 404: Netlify App.

So, you can either more the file elsewhere, or add an explicit rewrite to your _redirects file.