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

I have a Rails 3 project that uploads / downloads a file with permissions (the User has many Files and can only read / write his own files).

If I store files on a classic file system, I can check access to the file in my rails application, and then use the X-Sendfile header to redirect to the file if the user has access. Thus, the user cannot access the file without permission, and the download is quick.

  • Can I download files from GridFS as fast as the X-Sendfile and pass docking with them through the rails / rack?

  • Would piping through rails / racks be terribly slow?

  • Can I download files from GridFS as fast as the X-Sendfile and pass docking with them through the rails / rack, AND ALSO have the ability to force access rights?

+3
source share
1 answer

So far, I have found and thought about possible solutions:

  • Use something like gridfs-fuse to connect GFS to the local FS and use the X-Sendfile as always.

  • Use something like nginx-gridfs , which is c-fast and out-of-rails (doesn't block my req- application at boot time). The disadvantage is that it is server specific

+1

Source: https://habr.com/ru/post/1771962/


All Articles