meotimdihia
meotimdihia

Reputation: 4299

can I use CDN with images?

can I use CDN with images ? and if can then how to use it with upload from website to CDN server

Upvotes: 2

Views: 6454

Answers (4)

Itay Taragano
Itay Taragano

Reputation: 1931

In common CDN setups you actually don't upload images to the CDN. Instead, you access your images via a CDN, quite like accessing resources via an online Proxy. The CDN, in turn, will cache your images according to your HTTP cache headers and make sure that subsequent calls for the same image will be returned from the closest CDN edge.

Some recommended CDNs - AWS CloudFront, Edgecast, MaxCDN, Akamai.

Specifically for images, you might want to take a look at Cloudinary, http://cloudinary.com (the company I work at). We do all of this for you - you upload images to Cloudinary, request Cloudinary for on-the-fly image transformations, and get the results delivered via Akamai's high-end CDN.

Upvotes: 2

MikeBoss
MikeBoss

Reputation: 385

Seems like there are a few options to accomplish this.

The first one would be using the CDN as Origin. In which case, there is already an answer with some advice.

The second option would be using your current website as Origin for the images. In which case you will need to do some DNS work that would look something like this:

Published URL -> CDN -> Public Origin

Step 1 - images.yoursite.com IN CNAME images.yoursite.com.edgesuite.net --- This entry will send all traffic requests for the images subdomain to Akamai's CDN edge network.

Step 2 - origin-images.yoursite.com IN A or IN CNAME Public front end for the images

So the way it works is that in step one you get a request for one of your images, which will be then sent via DNS to the edge network in the CDN (in this case Akamai HTTP only). If the CDN does not already have the image in cache or if its cache TTL is expired, it will then forward the request to the public origin you have setup to pull the file, apply any custom behavior rules (rewrites, cache controls override, etc), cache the content if marked as cacheable and then serve the file to the client.

There is a lot of customization that can be done when serving static content via CDN. The example above is very superficial and it is that way to easily illustrate the logic at a very high level.

Upvotes: 3

Piers Karsenbarg
Piers Karsenbarg

Reputation: 3201

Do you mean you want to use a CDN to host images? And you want to upload images from your website to the CDN or use the website run by the company hosting the CDN to upload the images?

Ok, firstly yes you can use a CDN with images. In fact it's advised to do so.

Amazon CloudFront and RackspaceCloud's Cloudfiles are the two that immediately spring to mind. Cloudfiles you can upload either by their API or through their website and CloudFront you upload to Amazon's S3 storage which then hooks into the CloudFront CDN.

Upvotes: 2

ajreal
ajreal

Reputation: 47321

Yes, and you can check with your CDN provider on the methods they allow for uploading,

such as

pull (CDN server download the files from your website/server)

or

push (sent from your website/server to the CDN server)

Example : automatic push to CDN deployment strategy

Upvotes: 2

Related Questions