2

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 (.*) http://www.google.com/$1 [R]

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

domain.com/images/something/smth.jpg

would redirect to

etc.cf.net/images/something/smth.jpg

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 ? )

Scott Pack
  • 14,907
  • 10
  • 53
  • 83
Adrian A.
  • 85
  • 1
  • 2
  • 12

2 Answers2

2

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.

Mike
  • 22,310
  • 7
  • 56
  • 79
1

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.

mr-euro
  • 848
  • 3
  • 14
  • 31