Monday, July 01, 2013

How to Setup Amazon Cloud Front in Rails 3.2 app

I bought my domain at It is hosted at Linode.

Step 1 : I used Linode control panel to create a CNAME. It looks like this:

CNAME Records
Hostname Aliases to TTL
cdn Default
www Default

Step 2 : Go to Amazon Cloud Front and setup a CDN distribution. I followed the instructions from this blog:

Note that you should also provide alternate domain name. In my case it was

Step 3 : In production.rb add :

  config.action_controller.asset_host = ""

You can also setup a CNAME like to point to I am using https for the entire site. Since I did not have wildcard SSL certificate, it did not work so I am using for now. Amazon also has a documentation that shows how to use SSL with your cname. If you have issues, make sure you clear all the history in the browser and hit the URL to see if you can view the css and javascript.