开发者

Alternative to X-Sendfile on Heroku?

I have plans this summer to build an E-commerce app for digital downloads and I usually deploy on Heroku. However, Heroku doesn't support X-Sendfile.

So, what's the alternative?

I've been searching fo开发者_运维百科r gems and was thinking this might be a good replacement: https://github.com/marcel/aws-s3 -- but, I'm not sure it's being actively maintained.


You should keep your assets on a CDN like S3/Cloudfront. Then just redirect requests to it as necessary.

I would also use paperclip to manage the file. It could look something like ...

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

That should get your started. Hope this helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜