Mobile app version of vmapp.org
Login or Join
Hamaas447

: How does a CDN work on the tech side? I never used a CDN before so this is a noob question, but how does it work on the tech side. For example right now when a user uploads an image

@Hamaas447

Posted in: #AmazonS3 #Cdn #Php

I never used a CDN before so this is a noob question, but how does it work on the tech side.

For example right now when a user uploads an image on my site it is uploaded to the "/uploads" folder at the root of my "www" folder via PHP. If I use Amazon S3, how will I make the images my users upload, go directly to Amazon's servers instead of mine?

Or does it work a different way like the images are still uploaded to my server but then I have to move them to the amazon server either manually or through a CRON job? Basically can someone explain to me how it works?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamaas447

2 Comments

Sorted by latest first Latest Oldest Best

 

@Bryan171

Or does it work a different way like the images are still uploaded to my server but then I have to move them to the amazon server either manually or through a CRON job? Basically can someone explain to me how it works?


Amazon's CloudFront supports "origin-pull" (via "custom origin"), where you tell it to look at your site for the files if it doesn't have a copy stored already. This prevents you from having to do any mirroring to S3.

10% popularity Vote Up Vote Down


 

@Margaret670

A common way that CDN services work is whats known as origin based. What this means is you can have a secret. folder were all the content you want the cdn to be looking for is help. You allow users to upload to this folder normally and when in your code you give a URL like. cdn.example.com/images/my.png the cdn service will look at your site and download a copy of my.png then save a cache a copy on there network. Now all loads after this will load from the cdn. After sometime the cdn may come back and check to make sure that the image is still the same image. But once the cdn's network has the file they are able to share it with there servers world wide making your site faster.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme