Перейти к содержимому
Skip to content
← All articles

What Is a CDN and How Does It Speed Up Your Website

A CDN (Content Delivery Network) is a geographically distributed network of servers that delivers content to users from the nearest node. If your server is in Moscow and the user is in Vladivostok, a CDN allows content to be served from a server in Khabarovsk or Vladivostok, reducing latency by several times.

How a CDN Works

The principle behind a CDN is based on several key technologies:

Points of Presence (PoP)

A CDN consists of numerous servers (edge servers) located in data centers around the world. Each such data center is called a Point of Presence. Major CDN providers have hundreds of points of presence on every continent.

When a user requests a page, the CDN's DNS system routes them to the nearest edge server. The server selection is based on:

Content Caching

Edge servers store cached copies of content. On the first request, the CDN retrieves content from the origin server (your main server), stores it in cache, and serves it to the user. Subsequent requests are served from cache without contacting the origin.

Types of content cached by CDNs:

Content TypeCacheabilityNotes
Images (JPG, PNG, WebP, AVIF)Highly cacheableMajority of traffic
CSS, JavaScript filesHighly cacheableUse hashes in filenames
Fonts (WOFF2, WOFF)Highly cacheableDon't forget CORS headers
Video and audioWell cacheableConsider bandwidth
HTML pagesConditionally cacheableDepends on how dynamic the content is
API документацию responsesPartially cacheableOnly for GET requests with short TTL

Pull vs Push Models

Pull model — the CDN fetches content from the origin server on the first request and then caches it. This is the most common model and is simple to set up.

Push model — you pre-upload content to CDN servers. This is suitable for large files (videos, distributions) where it is important to guarantee availability from the first request.

Benefits of a CDN

1. Reduced Latency

Physical distance between the client and server directly affects latency. The speed of light in fiber optics is approximately 200,000 km/s. The Moscow–Vladivostok route (~9,000 km) adds a minimum of 45 ms just for one-way signal transmission. Accounting for routing, real latency can be 100–150 ms one way.

A CDN reduces this latency to 5–20 ms by serving content from the nearest server. You can check your site's TTFB using the enterno.io HTTP header checker tool.

2. Reduced Origin Server Load

A CDN absorbs the bulk of traffic, freeing your server to handle dynamic requests. With proper configuration, a CDN can handle 90–95% of all requests without contacting the origin.

3. DDoS Protection

CDN providers have distributed infrastructure with enormous bandwidth. Cloudflare, for example, handles over 50 million HTTP requests per second under normal conditions. During a DDoS attack, traffic is absorbed by the CDN network before reaching your origin server.

4. Improved Availability

If one edge server goes down, traffic is automatically redirected to the next nearest server. Many CDNs guarantee an SLA of 99.99% or higher.

5. Automatic Optimization

Modern CDNs offer additional capabilities:

Popular CDN Providers

Cloudflare

The most popular CDN with a free plan. In addition to CDN, it provides DNS, WAF, DDoS protection, Workers (serverless), and many other services. The free plan includes unlimited traffic, basic WAF, and SSL.

Fastly

A CDN with instant cache invalidation (purge in 150 ms). Used by GitHub, Reddit, and Pinterest. A powerful VCL platform for edge logic configuration, but more expensive than Cloudflare.

AWS CloudFront

Amazon's CDN, deeply integrated with the AWS ecosystem. An ideal choice if your infrastructure is already on AWS. Supports Lambda@Edge for serverless logic on edge servers.

Selectel CDN and CDNvideo

Russian CDN providers with points of presence in Russia and the CIS. They may be preferred for projects targeting a Russian audience for regulatory and low-latency considerations.

How to Set Up a CDN

Basic Setup

  1. Sign up with a CDN provider and add your domain
  2. Change DNS — point the domain to the CDN (usually by changing NS records or adding a CNAME)
  3. Configure the origin — specify the IP address or domain of your server
  4. Set up SSL — enable SSL/TLS проверку on the CDN (most providers offer a free certificate)
  5. Check headers — ensure that Cache-Control is configured correctly

Verifying CDN Operation

After setup, verify that the CDN is working correctly:

Caching Configuration

Proper caching configuration is the key to CDN effectiveness:

# Example Cache-Control configuration in nginx
location ~* \.(jpg|jpeg|png|gif|webp|avif|svg|ico|css|js|woff2)$ {
    expires 365d;
    add_header Cache-Control "public, max-age=31536000, immutable";
}

location ~* \.html$ {
    add_header Cache-Control "no-cache";
}

Edge Computing — The Future of CDN

Modern CDNs go beyond simple caching. Edge computing allows running code directly on edge servers, closer to the user:

This enables content personalization, A/B testing, authentication handling, and response transformation without contacting the origin server.

Common Mistakes When Using a CDN

When You Don't Need a CDN

A CDN may be unnecessary if:

However, even in these cases, Cloudflare's free plan can provide benefits through SSL, attack protection, and DNS acceleration.

Try It Yourself

Check whether your site uses a CDN with the enterno.io HTTP header analyzer — look for the CF-Ray, X-Cache, X-CDN headers.

Check your website right now

Check now →
More articles: Infrastructure
Infrastructure
API Rate Limiting: Why and How to Implement
14.03.2026 · 15 views
Infrastructure
Reverse Proxy: How It Works and Why You Need One
16.03.2026 · 20 views
Infrastructure
API Versioning Strategies: URL, Header, and Query Parameter Approaches
16.03.2026 · 25 views
Infrastructure
CDN: How It Works and Why You Need It
14.03.2026 · 13 views