I solved a similar problem by using an Openstack object store. I upload all files to a private container and in my application, I redirect authorized users to a temporary URL on the object store. This way users can download the files directly from the object store.
Protect all files in a directory - user auth
I'm planning to build a review site for my clients with Laravel. I'll be uploading things like static HTML pages or microsites which I will upload to a subdirectory. eg /public/files/client id/project id/version/
I want to protect all files inside a client's "files" directory such that only the logged in client can view something like /public/files/client1/microsite1/v1/index.html and all files that load into the page (images, etc). I'll also be placing .zips of deliverable project files there. So I need to be able to protect the .zips from being downloaded by non-authenticated users. i don't believe I can do with this Laravel's Auth.
Is there a way to do this with Laravel? Or do I need to use .htaccess somehow? Or am I approaching this the wrong way? Any suggestions are welcome.
I have an older client review site that uses .htaccess to check a cookie to make sure the user is logged in, only then allowing files to be served. can i do something like that, maybe using the CSRF token or something?
Thanks!
Please or to participate in this conversation.