我计划今年夏天为数字下载构建一个电子商务应用程序,我通常部署在Heroku上。然而,Heroku不支持X-Sendfile。
那么,还有什么选择呢?
我一直在寻找宝石,并认为这可能是一个很好的替代品:https://github.com/marcel/aws-s3 --但是,我不确定它是否得到了积极的维护。
发布于 2011-06-18 05:02:22
您应该将资产保存在类似S3/Cloudfront的CDN上。然后根据需要将请求重定向到它。
我也会用回形针来管理文件。它可能看起来像...
class AssetController < ApplicationController
def show
@asset = Asset.find(params[:id])
redirect_to URI.encode @asset.file.url
end
end
class Asset
has_attached_file :file,
:path => YOUR_PATH,
:storage => :s3,
:s3_credentials => S3_CONFIG,
:bucket => BUCKET_NAME
end这应该可以让你开始学习了。希望这能有所帮助
https://stackoverflow.com/questions/6307135
复制相似问题