开发者

MongoDB's GridFS, Rails 3, X-Sendfile, and ACL's, HOW-TO?

开发者 https://www.devze.com 2023-01-22 15:38 出处:网络
I have a Rails 3 project that does file upload/download, with access rights (User has many Files, and can only read/write his own files).

I have a Rails 3 project that does file upload/download, with access rights (User has many Files, and can only read/write his own files).

If I store my files on classic filesystem, I can check the access to the file in my rails app and then use X-S开发者_如何学Pythonendfile header to redirect to the file, if user has access. In this way, a user can never access a file without permission, and the download is fast.

  1. Can I make file download from GridFS as fast as X-Sendfile, and skip the hassle of piping them trough rails/rack ?

  2. Piping them trough rails/rack would be horribly slow ?

  3. Can I make file download from GridFS as fast as X-Sendfile, and skip the hassle of piping them trough rails/rack, AND ALSO have the ability to enforce access rights ?


Up until now I've found and thought of to possible solutions:

  1. Use something like gridfs-fuse to mount the GFS to local FS and use X-Sendfile just as allways.

  2. Use something like nginx-gridfs which is c-fast and out-of-rails (does not block my app's req-resp cycle while downloading). The downside is that it's server specific

0

精彩评论

暂无评论...
验证码 换一张
取 消