-
-
Save JoeyGo23/f69f9927dd8428c4423c to your computer and use it in GitHub Desktop.
Revisions
-
francirp created this gist
Feb 24, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ Cloudfront --- First, create a new Cloudfront distribution via Amazon AWS console. Once you've done that, it's as simple as adding the following to your production environment (and staging if you run a staging environment), replacing the value with your CDN host url: ```config.action_controller.asset_host = "<YOUR DISTRIBUTION SUBDOMAIN>.cloudfront.net"``` See here for more info: https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn#adding-cloudfront-to-rails Gzip --- This boosts performance. Helpful post here: http://thediscoblog.com/blog/2013/05/01/the-rails-cloudfront-and-heroku-performance-hat-trick/ To add gzip via Heroku Deflater gem: Gemfile.rb: ```ruby gem 'heroku-deflater', group: [:production, :staging] ``` config/environments/production.rb and config/environments/staging.rb: ```ruby config.static_cache_control = 'public, max-age=31536000' config.middleware.delete "ActionDispatch::Static" config.middleware.insert_before(Rack::Runtime, ActionDispatch::Static, paths["public"].first, config.static_cache_control) ``` You can see the result on our site: www.launchpadlab.com