JSON files in theme asset folder give 404 error


I have been accessing a .json file out of my theme asset folder for a long time now. Suddenly after upgrading to latest ghost it doesn’t work, however, it still works online on my production site. It only stopped working locally. When I try to navigate or fetch this .json file I get a 404 from ghost. Changing the file extension to .js makes it work again. It is only .json files that cannot be served from assets folder. I read this was by design, but that it was only supposed to be the root folder that couldn’t serve json. Putting the file in /content/files/ works just fine. I can navigate to /content/files/file.json just fine. What is going on here? Why will ghost suddenly not allow me to use .json files in my theme folder?

Edit: I think the problem started because I updated to the latest Ghost-CLI, and ghost -CLI is what runs the website in development mode, as opposed to nginx/apache in production. Something in this new ghost-CLI is causing a permanent redirect when navigating to .json files from within the theme/assets/ folder

In development mode Ghost (the app) is solely responsible for serving all requests. In this case, the CLI just allows starting and stopping the instance without using a full-fledged process manager.

1 Like

Thank you vikas. Do you know how I can get .json files to be served out of my assets folder locally? It only works in production.