Last active
April 4, 2019 17:18
-
-
Save ugisozols/6778058 to your computer and use it in GitHub Desktop.
Refinery CMS + Dragonfly + Amazon S3 + Amazon Cloudfront
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environments/production.rb: | |
config.action_controller.asset_host = "http://cdn%d.example.com" | |
# config/initializers/refinery/images.rb: | |
config.dragonfly_url_format = "/images/:job/:basename.:ext" | |
if Rails.env.production? | |
config.dragonfly_url_host = "http://cdn4.example.com" | |
end | |
# config/initializers/refinery/resources.rb: | |
config.dragonfly_url_format = "/resources/:job/:basename.:format" | |
if Rails.env.production? | |
config.dragonfly_url_host = "http://cdn5.example.com" | |
end | |
---------------------- | |
Configure 2 Amazon Cloudfront distributions: | |
1st pointing to S3 bucket and configured with these CNAMES: cdn0.example.com, | |
cdn1.example.com, cdn2.example.com and cdn3.example.com | |
2nd pointing to your site (in this example - example.com) because Dragonfly | |
generates thumbnails on the fly. This distribution is also configured with | |
these CNAMES: cdn4.example.com, cdn5.example.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@cjbrew it generates an integer number
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html