Skip to content

Instantly share code, notes, and snippets.

@andru255
Forked from maxivak/rails-assets-cdn.md
Created May 28, 2014 17:46
Show Gist options
  • Select an option

  • Save andru255/56ec43c0df72b146cac4 to your computer and use it in GitHub Desktop.

Select an option

Save andru255/56ec43c0df72b146cac4 to your computer and use it in GitHub Desktop.
# serve all assets from CDN server
config.action_controller.asset_host = 'http://cdn.mydomain.com'
#or if your files in a folder on CDN server
config.action_controller.asset_host = 'http://cdn.mydomain.com/myfolder'
# serve only images
config.action_controller.asset_host = Proc.new { |source|
if source =~ /\b(.png|.jpg|.gif)\b/i
"http://cdn.mydomain.com"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment