Dynamically added file to public directory is not accessible from browser

I am trying to upload the files in public directory(web.browser/app) and try to access the file on browser.
But browser wont serve the files added on the run time.
However, I added a static file in the public directory, built the application and deployed. Static file is accessible from browser. After some research I came across program.json inside web.broswer (in development server, not in local server) which has paths and urls mapping to files inside public directory(web.browser/app/).
My question is how to configure so that program.json gives access to all the files inside public directory(web.browser/app/) ? Or do we have any other way to access dynamically added files inside public directory ? I am trying not to S3 or any other 3rd party storages.

Just bumping this because I am also facing similar issues.

Can any of the Meteor OG’s confirm - Do I have to actually restart Meteor to get a file made in public to not 404? Or is there any other way - Because from what i see this will mean I have to run a secondary vhost simply to host files that are made and need to be available immediately. Do deployed apps behave in the same way and force restarts in order to have files available?

Thank you for any help on this

public folder is not meant for file uploads. Its for static files that are there on build-time.

ideally use a s3-like solution for file uploads. There is minio which is a self-hosted s3 compatible solution.

that way you can also keep your web-apps stateless, which makes backups, failover and horizontal scaling easier

Thanks for explaining. I don’t use S3 and can’t use any cloud services due to the nature of my software and the legal ramifications.

Thanks for the minio recommendation. I think what I’ll do is just run nginx with a vhost to a directory outside the app so I can write to that and have it hosted.

that way you can also keep your web-apps stateless, which makes backups, failover and horizontal scaling easier

I get it now man thanks, it is what it is. It does stand as a hurdle if you don’t need any of that and run a single instance but I’ll work around it.

1 Like