是否可以在 spree 中使用像 Amazon Cloudfront 这样的 CDN?我知道我可以在 生产.rb
中设置 config.action_controller.asset_host
,但这不会影响 Spree::Image
或任何spree 辅助函数如 product_image()
。
此外,带有 s3_protocol
设置的 /admin/image_settings/edit
网址,似乎没有任何效果,甚至将其设置为空白。我希望与协议(protocol)无关,并将 URL 形成为 //foo.cloudfront.com
最佳答案
Spree 的图片 uploader 提供 Paperclip gem 。 Using Cloudfront with Paperclip 有一个方便的指南。 Paperclip 不会使用 asset_host。
第一步是让您的 S3 镜像托管按照您想要的方式工作,然后通过 Cloudfront 使其工作。
s3_protocol 为 '' 应使用协议(protocol)相对 URL,如 this pull request 所示.
关于ruby-on-rails - 对 Spree::Images 使用 CDN 和 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18141315/