professormeowingtons
professormeowingtons

Reputation: 3514

Use CDN and HTTPS for Spree::Images

Is it possible to use a CDN like Amazon Cloudfront with spree? I know I can set config.action_controller.asset_host in production.rb, but this doesn't affect the Spree::Image, or any spree helper functions like product_image().

Also, the /admin/image_settings/edit url with setting for s3_protocol, which seems to have no effect, even setting it to blank. I would like to be protocol agnostic, and have the URLs formed like //foo.cloudfront.com

Upvotes: 2

Views: 850

Answers (1)

gmacdougall
gmacdougall

Reputation: 4911

Spree's image uploader is provided the Paperclip gem. There's a handy guide for Using Cloudfront with Paperclip. Paperclip will not use asset_host.

The first step would be to get your S3 image hosting working the way you want, and then get it to work through Cloudfront.

s3_protocol being '' should use protocol relative URL's as shown in this pull request.

Upvotes: 4

Related Questions