MongoDB 的 GridFS、Rails 3、X-Sendfile 和 ACL,如何操作?
我有一个Rails 3项目,可以进行文件上传/下载,具有访问权限(用户有很多文件,并且只能读/写他自己的文件)。
如果我将文件存储在经典文件系统上,我可以在 Rails 应用程序中检查对文件的访问权限,然后使用 X-Sendfile 标头重定向到该文件(如果用户具有访问权限)。这样,用户在未经许可的情况下永远无法访问文件,并且下载速度很快。
我可以像 X-Sendfile 一样快速地从 GridFS 下载文件,并跳过通过导轨/机架进行管道传输的麻烦吗?
通过导轨/机架对它们进行管道输送会非常慢吗?
我可以像 X-Sendfile 一样快速地从 GridFS 下载文件,并跳过通过导轨/机架进行管道传输的麻烦,并且还能够强制执行访问权限吗?
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.
Can I make file download from GridFS as fast as X-Sendfile, and skip the hassle of piping them trough rails/rack ?
Piping them trough rails/rack would be horribly slow ?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
到目前为止,我已经找到并想到了可能的解决方案:
使用类似 gridfs-fuse< /a> 将 GFS 安装到本地 FS 并像平常一样使用 X-Sendfile。
使用像nginx-gridfs这样的东西,它是c-fast并且out-of-rails (下载时不会阻止我的应用程序的 req-resp 周期)。缺点是它是特定于服务器的
Up until now I've found and thought of to possible solutions:
Use something like gridfs-fuse to mount the GFS to local FS and use X-Sendfile just as allways.
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