MyShop's logo is the same every day. If the browser downloaded it again every time you opened a page, time and data would be spent on the very same thing. It is better for the browser to take a copy from the nearest place that has one.
Three places for a copy
The browser looks for a copy, starting with the nearest place:
- The browser cache: copies that the browser keeps on your own phone. The fastest, because nothing has to be asked for over the internet.
- A CDN: servers that hold copies, spread over many cities, close to visitors. One copy there serves everyone around it.
- The origin server: where the original file is kept, maybe in another country. It is only visited when the browser cache and the CDN have no copy yet.
The browser itself only asks the CDN. When the CDN has no copy yet, the CDN asks the origin server. Not every site uses a CDN: without one, the browser asks the origin server directly.
Who it helps
The browser cache helps only you. A copy at the CDN helps your neighbours too. Once one person in London has asked for the logo, the CDN in London keeps a copy. The next person in London doesn't wait for it to come from far away.
TL;DR: The browser takes a copy of a file from the nearest place: the browser cache on your own phone, then the CDN (servers with copies in many cities), and only then the origin server (where the original file is kept).
⚡ Take the nearest copy
Meaning: The same file, such as a logo, doesn't have to be downloaded from far away again. The browser first looks for a copy in the browser cache, on your own phone. If there is none, it asks a CDN, servers with copies spread over many cities. Only when neither has one does it go to the origin server, where the original file is kept.
⚡ A CDN helps the neighbours
Guess first: someone in London has just asked for MyShop's logo. A minute later, another person in London opens MyShop for the first time, on a new phone. Where does the logo come from?
From the CDN in their city. The new phone has no cache yet, but the CDN in London already keeps a copy.
Meaning: The browser cache helps only you. A copy at the CDN helps your neighbours too.