What is a CDN
A CDN (Content Delivery Network) is a solution of distribution that websites integrate into their data transfer structure. This technology allows the files (usually images or other static files) to be replicated on various data centers around the world. This is what is meant by caching the files close to the end-user's location
How does it work
When we receive a request from the end-user for a specific file, we will check the closest server, verify if it is in the cache, and then based on the cache status.
If the file is in the cache, we will check the expiration time for the file's cache, and if all data are valid, we will deliver the file to the end-user.
In case that the file isn't cached yet, we will request the file from the Origin server, so we can cache it on the Edge and deliver it to the end-user.
Once we cache the file, we can deliver it again to other end-users significantly faster.
Updated on 2nd October, 2024