Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some of you may have a solution for this, and I need to hear it. Basically, you have a website, a lot of categories ( games, blog etc ).

The idea would be to use Amazon CDN for images, flv's, javascript js, and css. What's the best way to implement Amazon CloudFront to make this work?

Would I sync only the images etc, keeping the structure intact? I've been using

RewriteEngine On
RewriteCond %{REQUEST_URI} .*jpg$|.*gif$|.*png$ [NC]
RewriteRule (.*)$1 [R]

in order to server images, but also keeping the relative paths. So

would redirect to

The idea is to make no changes to the website. I'm not sure if to not kick s3fs directly to the image directories, and have everything upload to the respective mount points ( is the speed fast enough ? )

share|improve this question
Why are you considering implementing CloudFront? What are you trying to achieve here? – kaerast Jun 22 '10 at 20:34
This is related to alot of SEO stuff, ranking etc. – Adrian A. Jun 23 '10 at 16:37

Not really the best use of a CDN.. the idea is to take requests away from your webserver.. All that will do is remove the bandwidth.

Its better to change the code itself to take the request for the images out of the webserver.

share|improve this answer
If that were possible, I wouldn't be asking for ideas on alternative solutions :) – Adrian A. Jun 23 '10 at 16:36

You could use some output buffering and cache to process all links and change them to the CF CNAME before being sent to the client. Then set-up a custom origin CF pointing to your standard domain.

This will require no other changes and will route all traffic for static content to CF but actually leaving the original content on the same server as is.

The above could also be achieved client-side with some DOM manipulation using Javascript.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.