# Public folder (images, javascript) on Amazon's Cloudfront

**URL:** <https://www.ruby-forum.com/t/public-folder-images-javascript-on-amazons-cloudfront/153993>\
**Category:** Rails\
**Created:** [November 24, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/public-folder-images-javascript-on-amazons-cloudfront/153993 "2008-11-24T12:56:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jah4711](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@jah4711](https://www.ruby-forum.com/u/jah4711)\
**Post date:** [November 24, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/public-folder-images-javascript-on-amazons-cloudfront/153993/1 "2008-11-24T12:56:56Z")

</div>

Hi,

as the subject says I am currently considering to move all resources  
from my app to Cloudfront.  
I already googled for some best practices, but haven’t found much.  
However, despite that Cloudfront  
is quite new, I think that many Rails developers have thought about  
doing this.

As always thankful for any tips, tricks and suggestions.

---

<div class="post-metadata">

**Author:** ![jah4711](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@jah4711](https://www.ruby-forum.com/u/jah4711)\
**Post date:** [January 24, 2009, 10:38pm UTC](https://www.ruby-forum.com/t/public-folder-images-javascript-on-amazons-cloudfront/153993/2 "2009-01-24T22:38:31Z")

</div>

Is there a script to update cloudfront when i update the app on the  
production server? I want to keep it synched. I looked at clcurl.pl  
seemed overly complicated for what i was looking for.

On Nov 30 2008, 12:22 am, Helmut J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jah4711](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@jah4711](https://www.ruby-forum.com/u/jah4711)\
**Post date:** [November 30, 2008, 9:23am UTC](https://www.ruby-forum.com/t/public-folder-images-javascript-on-amazons-cloudfront/153993/3 "2008-11-30T09:23:19Z")

</div>

Maybe it is interesting for other Rails beginners. The solution is  
pretty easy and straight-forward. Just  
go to the production environment and there is a line:

# Enable serving of images, stylesheets, and javascripts from an asset

server  
config.action\_controller.asset\_host = “http://  
[assets.example.com](http://assets.example.com)”

That’s it!

---

<div class="post-metadata">

**Author:** ![jah4711](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@jah4711](https://www.ruby-forum.com/u/jah4711)\
**Post date:** [March 4, 2009, 6:31pm UTC](https://www.ruby-forum.com/t/public-folder-images-javascript-on-amazons-cloudfront/153993/4 "2009-03-04T18:31:13Z")

</div>

I know it’s a little late in the game, but I had the same thought, and  
wrote up a pretty simple plugin to do this for you:

[http://code.google.com/p/xlr8/](http://code.google.com/p/xlr8/)
