A CDN (content delivery network) is a set of servers in cities around the world that keep copies of a website's static files and hand them to each visitor from the nearest one.
Your site still lives on one server, but most of what a browser downloads no longer has to cross the planet to reach it.
The problem: one server, many places
Every website starts on an origin server: the machine (or cluster) where the site lives. If that server sits in London, a visitor in London gets a quick answer. A visitor in Sydney waits, because every request and every response travels roughly 17,000 km each way.
Distance costs time no matter how fast the server is. Light in optical fibre covers about 200 km per millisecond, so a London to Sydney round trip can't take less than about 170 ms, and real cable routes are longer than a straight line. Loading one page takes several round trips: looking up the name, opening the connection, setting up encryption, then fetching the HTML, the stylesheets, the scripts and every image. Those delays stack up, which is why the same site can feel instant in one country and sluggish in another.
What a CDN does
A CDN runs servers, usually called edge servers, in data centres spread around the world. Each location is a point of presence, or PoP. When you put a site behind a CDN, visitors are routed to a nearby edge server instead of straight to the origin. That routing is usually done with DNS: the site's name points at the CDN, and the CDN answers with an address close to the person asking.
The edge server keeps cached copies of the site's files. A cache is a stored copy of something that is slow or expensive to fetch again. If the edge already has the file, it sends it straight back from a few hundred kilometres away rather than from the other side of the world.
Static content is what it caches best
CDNs work best with static content: files that are the same for every visitor until you change them. Images, videos, fonts, CSS and JavaScript bundles all fit. A logo looks the same for everyone, so one cached copy can serve thousands of people.
Dynamic content is harder. A basket page, an account dashboard or an API response built for one signed-in user can't be shared, because the next visitor would see someone else's data. Many sites send those requests through the CDN anyway (it can still speed up the connection and filter attacks) but tell it not to cache them.
Wondering how this was made? How we make these