What is a content delivery network?
Learn how a CDN serves cached content nearer visitors, which pages need careful rules and why it cannot fix every cause of a slow website.
A content delivery network, or CDN, places copies of suitable website responses closer to visitors and can reduce work for the origin server. It is most straightforward for images, stylesheets and other assets that can be reused safely. It will not automatically make a slow application or heavy page fast, so measure the problem before adding one.
Follow a request through the cache
Without a CDN, a browser requests content from the origin hosting environment, subject to browser and network caching. With a CDN, a nearby edge location may answer from a stored copy. If no suitable copy exists, it requests the content from the origin and may store the result for later requests.
This can reduce transfer distance and origin work for repeatable content. The MDN HTTP caching guide explains the distinction between private browser caches and shared caches such as CDNs. The benefit depends on the audience, content, cache settings and how often the same resource is requested.
Decide what is safe to cache
Public images and versioned assets are usually easier to cache than personalised account pages. A logged-in page, basket or booking status can contain private or changing information. Configure cache behaviour around those risks; never assume a default rule will understand your application.
For each page type, ask whether visitors should receive identical content and how quickly an update must appear. If a price or policy changes, a stale edge copy can be misleading. Keep a documented way to purge or invalidate content and test it after a release. Asset filenames that change with the content can make long-lived caches easier to manage.
Check what the CDN does not fix
A CDN cannot remove a large JavaScript bundle, an inefficient database query or an image that is needlessly huge. It may hide some origin latency for cached pages while dynamic requests remain slow. Compare the same user journey before and after, looking at page weight, backend time and cache hits rather than a single headline score.
The shared-hosting speed guide helps separate hosting limits from page-level problems. It is sensible to optimise images, scripts and caching rules before assuming a different network layer is the only answer.
Plan operation and failure handling
Record who manages CDN DNS, certificates, cache rules and access. Check the path from edge to origin over HTTPS. Know how to bypass or disable a faulty rule and how long it may take for changes to appear. Test forms, logins and admin pages after enabling the CDN.
A CDN is a useful tool when repeatable content or a dispersed audience justifies it. Treat it as part of the service architecture, with ownership, testing and monitoring, rather than as a one-click speed guarantee.
Frequently asked questions
Does a CDN replace web hosting?
Usually no. The origin still stores or generates the website, while the CDN may serve cached copies and pass other requests through to that origin.
Can a CDN make content appear out of date?
Yes. A cached response can remain visible after an origin update until it expires or is invalidated. Plan cache rules and a purge process for important changes.
Should account pages be cached at the edge?
Treat personalised pages with particular care. A shared cache must never serve one person's private content to another; use application-aware rules and test logged-in journeys thoroughly.
HELP US IMPROVE
Was this article useful?
Your feedback helps shape future coverage.