Problems with static app and LocalFileAdapter
See original GitHub issueBug report
Describe the bug
I have a keystone app with a StaticApp configured to serve files located on the public folder on the root of my project:
new StaticApp({ path: '/public', src: 'public' })
and a LocalFileAdapter configured to store files on a subdirectory of the static app path:
const fileAdapter = new LocalFileAdapter({
src: 'public/uploads',
path: '/public/uploads'
});
This setup works fine on development mode but in production mode when the app is built the contents of the root public folder are copied to dist/public
and thats the folder served by the keystone server… so when a file is uploaded using the admin UI it goes through the LocalFileAdapter to the public
folder on the root of my project so I get a 404 when I try to access the file using the public path URL because the file does not exist in dist/public
.
To Reproduce
Explained above.
System information
- OS: macOS and Linux
- Browser: any
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Express-js can't GET my static files, why? - Stack Overflow
I have resolved the problem with following code: app.use('/img',express.static(path.join(__dirname, 'public/images'))); app.use('/js' ...
Read more >Debugging issues with static files - PythonAnywhere help
Your static files mapping is not active yet. You may need to reload your web app. You've used a relative path instead of...
Read more >Static files in ASP.NET Core | Microsoft Learn
Static files, such as HTML, CSS, images, and JavaScript, are assets an ASP.NET Core app serves directly to clients by default.
Read more >problem serving static files in digital ocean app platform - Reddit
Hello Everyone, i created a simple project in django and i'm trying to deploy it on digital ocean with the app platform. i...
Read more >How Do You Serve Static Files in Flask? - Sentry
But when you run your Flask app, the static files are not found and do not show up on your webpage. The problem...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s the same… I understand the behavior of the Static App is correct and I finally set up the local file adapter to save the files in a different folder and set up nginx in production to serve that folder as static content.
While in development I use express.static:
Maybe there is a better way but for the time being this works for me.
Hey,
Does the file adapter throw weird error responses on your nginx server?
Mine goes like this when I try to upload an image (works fine on localhost/development):
And the image isn’t uploaded to the webserver. File permissions are 755 across the board…
Thanks for any feedback