views:

31

answers:

1

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-Sendfile 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 ?

A: 

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

clyfe