Internet Module 3

3.7 Content Delivery Networks

In the previous sections, we learned about domain names, DNS, web hosting, web servers, and different types of hosting.

  • A domain name gives people a readable name to type.
  • DNS helps the browser find the correct destination.
  • Web hosting stores and serves the website.

But there is still another problem.

What happens when users are far away from the website’s main server?

What happens when many people try to load the same website at the same time?

What happens when a website has large images, videos, scripts, downloads, or global traffic?

This is where Content Delivery Networks can help.

A Content Delivery Network is usually called a CDN.

A CDN is a network of servers placed in different locations so website content can be delivered faster, more reliably, and sometimes more securely.

Why CDNs Exist

Distance matters on the Internet.

Even though Internet communication can feel instant, data still has to travel through physical infrastructure. It may move through cables, routers, data centers, Internet providers, exchange points, undersea cables, wireless networks, or satellite links.

If a website’s main server is far away from the user, the request and response may take longer. This delay is called latency.

Latency is the time it takes for data to travel from one place to another.

Lower latency usually means a faster-feeling website. Higher latency can make a website feel slow, even if the server itself is working correctly.

CDNs help reduce latency by placing content closer to users. Instead of every visitor reaching all the way back to one main server, a CDN can deliver some content from a nearby server.

Origin Servers and Edge Servers

To understand CDNs, it helps to understand two terms: origin server and edge server.

The origin server is the main server that holds the original website or application content. It is the source of truth for the website.

An edge server is a CDN server located closer to users. Edge servers are often placed in many geographic regions and network locations.

For example, suppose a website’s origin server is in Virginia.

A user in Idaho visits the website.

Another user in Germany visits the website.

Another user in Japan visits the website.

Without a CDN, each user may need to connect back to the origin server in Virginia for the same files.

With a CDN, some of the website’s content may be served from edge servers closer to each user.

The user in Idaho may receive files from a nearby North American edge server.

The user in Germany may receive files from a European edge server.

The user in Japan may receive files from an Asian edge server.

The website can feel faster because the content does not always have to travel as far.

What CDNs Often Deliver

CDNs are often used to deliver static content. Static content is content that does not change for every user.

Examples include:

  • Images
  • Videos
  • CSS files
  • JavaScript files
  • Fonts
  • Documents
  • Software downloads
  • Prebuilt website pages

These files are good candidates for CDN caching because many users may request the same content.

For example, if thousands of people visit a page that uses the same logo image, it would be inefficient for the origin server to send that logo separately to every visitor from one location. A CDN can store a copy of that logo on edge servers and deliver it from locations closer to users.

CDNs can also support dynamic content, streaming media, APIs, security filtering, and edge computing, depending on the provider and configuration.

However, the basic idea is still the same:

CDNs help deliver Internet content more efficiently.

Caching

One of the most important CDN concepts is caching.

Caching means temporarily storing a copy of something so it can be reused.

When a CDN caches a file, it stores a copy of that file on an edge server. Then, when another user requests the same file, the CDN may be able to send the cached copy instead of asking the origin server again. This can make websites faster and reduce load on the origin server.

For example:

  1. A user requests an image from a website.
  2. The CDN checks whether the image is already cached nearby.
  3. If the image is cached, the CDN sends the image from the edge server.
  4. If the image is not cached, the CDN requests it from the origin server.
  5. The CDN may save a copy so future users can receive it faster.

This is similar to DNS caching, but it is not the same thing.

DNS caching stores DNS answers.

CDN caching stores website content or other resources.

Both use caching to make Internet activity faster and more efficient.

Cache Hit and Cache Miss

Two common CDN terms are cache hit and cache miss.

A cache hit happens when the CDN already has the requested content saved and can deliver it from the cache.

A cache miss happens when the CDN does not have the requested content saved, so it must request the content from the origin server.

A cache hit is usually faster.

A cache miss usually takes longer because the CDN has to go back to the origin server first.

For example:

If the CDN already has a website’s logo image cached, that is a cache hit.

If the CDN does not have a newly uploaded image yet, that may be a cache miss.

After the CDN retrieves the image from the origin server, it may cache it for future requests.

CDNs and Website Speed

CDNs can improve website speed in several ways.

  • They can reduce distance between users and content.
  • They can reduce the amount of traffic reaching the origin server.
  • They can deliver cached files quickly from edge locations.
  • They can optimize images, compression, and connection settings.
  • They can help large files, videos, and downloads reach users more efficiently.

Speed matters because users often leave slow websites. Slow websites can also hurt search visibility, sales, learning experiences, and user trust.

A fast website feels easier to use. A slow website can make even good content feel frustrating.

CDNs and Reliability

CDNs can also improve reliability.

If a website gets a sudden traffic spike, the origin server may struggle to handle every request directly. A CDN can absorb some of that traffic by serving cached content from many edge servers. This reduces pressure on the origin server.

CDNs can also help route traffic around some network problems. If one path or location is having trouble, a CDN may be able to use another route or another edge location. This does not mean a CDN prevents every outage. A CDN can have problems too, but a well-configured CDN can make a website more resilient than relying only on one origin server.

CDNs and Security

Modern CDNs are often used for security as well as performance.

Many CDN providers offer security features such as:

  • DDoS protection
  • Web application firewall tools
  • Bot filtering
  • Rate limiting
  • TLS certificates for HTTPS
  • Traffic monitoring
  • Malicious request blocking

A DDoS attack is a distributed denial-of-service attack. In a DDoS attack, many systems send traffic toward a target in an attempt to overwhelm it. Because CDNs are designed to handle large amounts of traffic across many locations, they can help absorb or filter some of this traffic before it reaches the origin server.

CDNs can also hide the origin server from direct public exposure in some setups. This can make it harder for attackers to attack the origin directly.

However, a CDN does not make a website automatically safe. A website can still have insecure code, weak passwords, exposed admin panels, unsafe plugins, bad permissions, or misconfigured cloud storage.

A CDN can protect some parts of the delivery path, but the website itself still needs to be built and maintained securely.

CDNs and HTTPS

CDNs often help manage HTTPS connections. HTTPS protects the connection between the user’s browser and the website.

When a CDN is used, the user may connect to the CDN first. The CDN may then connect back to the origin server. This means HTTPS needs to be handled carefully.

In a secure setup, the connection from the user to the CDN is protected, and the connection from the CDN to the origin server is also protected. This matters because protecting only part of the path can create risk.

For example, if a user connects securely to the CDN but the CDN connects insecurely to the origin server, the full path is not protected in the same way.

CDNs and Dynamic Content

CDNs are often easiest to understand with static content like images, CSS files, and videos, but modern CDNs can also help with dynamic content.

Dynamic content changes based on the user, account, location, search, purchase, or other condition.

Some dynamic content cannot simply be cached and reused for everyone. For example, a user’s private account dashboard should not be cached and shown to other users. That would be a serious security problem.

However, CDNs can still help dynamic websites by improving routing, reducing connection time, protecting against attacks, optimizing traffic, or running certain code closer to users. This is sometimes called edge computing.

Edge computing means some processing happens closer to the user instead of only at the origin server.

For example, an edge function might redirect users, personalize limited content, check security rules, or handle a lightweight API request.

This is more advanced, but it shows how CDNs have evolved. They are not only simple file-copying systems anymore.

CDN Mistakes and Risks

CDNs are powerful, but they must be configured carefully.

Common CDN problems include:

  • Serving outdated cached content
  • Caching private information by mistake
  • Misconfigured HTTPS settings
  • Exposing the origin server directly
  • Blocking legitimate users with overly strict security rules
  • Allowing malicious traffic because rules are too weak
  • Creating confusing errors when the CDN cannot reach the origin server

A common CDN error happens when the CDN is working, but the origin server is not responding.

From the user’s perspective, the website may look broken. Behind the scenes, the CDN may be saying:

“I can receive the user’s request, but I cannot get the needed content from the origin server.”

This is why troubleshooting CDN-backed websites can involve several layers:

  • The user’s browser
  • DNS
  • The CDN
  • The origin server
  • The hosting provider
  • The application
  • The database
  • The network path between systems

The more systems involved, the more places there are for something to go wrong.

Why This Matters

CDNs help explain how modern websites can serve users across the world.

A website may have one origin server or a group of origin servers, but users do not always connect directly to that origin.

Instead, a CDN may help deliver content from edge servers closer to users. This can improve speed, reliability, scalability, and security.

CDNs are one reason websites, videos, downloads, apps, and online platforms can serve large audiences across many regions.

However, CDNs also introduce new responsibilities.

  • They must be configured carefully.
  • They must avoid caching private data.
  • They must handle HTTPS correctly.
  • They must work properly with the origin server.
  • They must be monitored when something breaks.

In this module we looked at the systems that help a person type a website name and receive a webpage:

  • Domain names give people readable names.
  • DNS helps translate those names into technical information.
  • DNS records provide instructions for domains and services.
  • Web hosting stores and serves website content.
  • Web servers respond to browser requests.
  • CDNs help deliver content faster and more reliably across distance.

In the next module, we will zoom out from websites and look at the larger infrastructure of the Internet itself. We will study IP addresses and routing, Internet service providers and network tiers, undersea cables and satellites, and the data centers that make Internet scale possible.