对Spree :: Images使用CDN和HTTPS

时间:2013-08-09 06:40:34

标签: ruby-on-rails spree

是否有可能使用像Amazon Cloudfront这样的CDN疯狂?我知道我可以在config.action_controller.asset_host中设置production.rb,但这不会影响Spree::Image或任何狂欢辅助函数,例如product_image()

此外,设置为/admin/image_settings/edit的{​​{1}}网址似乎无效,甚至将其设置为空白。我希望与协议无关,并使URL形成为s3_protocol

1 个答案:

答案 0 :(得分:4)

Spree的图像上传器提供了Paperclip gem。 Using Cloudfront with Paperclip有一个方便的指南。 Paperclip不会使用asset_host。

第一步是让您的S3图像托管以您想要的方式工作,然后通过Cloudfront使其工作。

s3_protocol是''应该使用协议相对URL,如this pull request所示。