A Content Delivery Network (CDN) caches your WordPress site's static and dynamic assets on edge servers distributed across the globe, serving content from the location closest to each visitor. A properly configured CDN reduces Time to First Byte (TTFB) by 50–80%, cuts total page load time by 40–60%, and offloads 70–90% of bandwidth from your origin server — all without modifying a single line of WordPress code.
What a CDN Actually Does
Without a CDN, every visitor's browser connects to your single origin server — wherever it's physically located. A visitor in Tokyo requesting a page from a server in Virginia adds 200–300ms of round-trip network latency before a single byte transfers. Multiply that by every asset on the page (HTML, CSS, JavaScript, images, fonts), and geographic distance alone can add 1–3 seconds to total page load.
A CDN solves this by caching copies of your content on servers in dozens or hundreds of locations worldwide. When a visitor in Tokyo requests your page, the CDN serves it from an edge server in Tokyo — reducing that 200–300ms round trip to 5–20ms.
What a CDN caches by default:
- Static assets: images, CSS, JavaScript, fonts, PDFs
- Full HTML pages (with proper cache rules)
- API responses (with cache headers)
What a CDN should NOT cache:
- Cart and checkout pages (WooCommerce)
- User account/dashboard pages
- Admin pages (
/wp-admin/) - Logged-in user responses
According to the HTTP Archive's 2025 Web Almanac, sites using a CDN have a median TTFB of 320ms compared to 890ms without — a 64% improvement. For WordPress specifically, CDN-enabled sites score an average of 18 points higher on PageSpeed Insights mobile tests.
How a CDN Improves Core Web Vitals
Core Web Vitals determine your Google ranking eligibility and directly impact user experience. A CDN improves two of the three metrics:
Largest Contentful Paint (LCP) — CDN caching eliminates origin server processing time for cached pages. Instead of WordPress executing PHP, querying MySQL, and rendering HTML on every request, the CDN returns a pre-built response in under 50ms. For image-heavy pages, CDN image optimization (auto WebP/AVIF conversion, resizing) reduces LCP further.
Interaction to Next Paint (INP) — By serving JavaScript files from edge locations and enabling HTTP/3 multiplexing, a CDN reduces the time between user interaction and browser response. Cloudflare's data shows a 12% average INP improvement after enabling their CDN (2025).
Cumulative Layout Shift (CLS) — CDNs don't directly affect layout shift, but CDN-based image optimization that preserves width/height attributes prevents CLS caused by late-loading images.
CDN Options for WordPress
Four CDN providers dominate the WordPress ecosystem. Each has different strengths depending on your traffic, budget, and geographic audience.
Cloudflare
Best for: Most WordPress sites. Free tier is generous enough for the majority of use cases.
| Feature | Free | Pro ($20/mo) | Business ($200/mo) |
|---|---|---|---|
| Edge locations | 300+ | 300+ | 300+ |
| Bandwidth | Unlimited | Unlimited | Unlimited |
| SSL | Universal | Universal + Advanced Certificates | Universal + Custom |
| DDoS protection | Basic | Advanced | Advanced + WAF |
| Image optimization | No | Polish (lossy/lossless) | Polish + Mirage |
| Page Rules | 3 | 20 | 50 |
| Argo Smart Routing | Add-on ($) | Add-on ($) | Included |
| Cache Analytics | Basic | Full | Full |
Cloudflare operates as a reverse proxy — all traffic passes through their network, enabling both CDN caching and security features without installing anything on your server.
Bunny.net
Best for: High-traffic sites needing precise billing control and consistently low latency.
- Pay-as-you-go pricing: $0.01/GB (North America and Europe)
- 123 edge locations across 6 continents
- Built-in image optimization (Bunny Optimizer)
- Pull zone setup — integrates via CNAME, no nameserver change required
- Average global TTFB of 28ms for cached assets (Bunny internal benchmark, 2025)
KeyCDN
Best for: Budget-conscious sites with moderate traffic.
- Pay-as-you-go: $0.04/GB (first 10 TB)
- 60+ edge locations
- Real-time analytics dashboard
- Let's Encrypt SSL integration
- WordPress plugin available for easy setup
Amazon CloudFront
Best for: Sites already in the AWS ecosystem or needing custom edge computing (Lambda@Edge).
- Pay-as-you-go pricing starting at $0.085/GB
- 450+ edge locations
- Deep integration with S3, EC2, and other AWS services
- Lambda@Edge for custom request/response logic
- More complex setup — requires AWS console or Terraform configuration
Setting Up Cloudflare for WordPress (Step by Step)
Cloudflare is the most popular CDN for WordPress — and the fastest to set up. This walkthrough covers a complete production configuration.
Step 1: Create a Cloudflare Account and Add Your Site
- Sign up at cloudflare.com (free tier works fine)
- Click "Add a Site" and enter your domain name
- Cloudflare scans your existing DNS records automatically
- Select the Free plan (upgrade later if needed)
Step 2: Update Your Nameservers
Cloudflare provides two nameservers (e.g., ada.ns.cloudflare.com and lee.ns.cloudflare.com). Update these at your domain registrar:
- Log into your registrar (GoDaddy, Namecheap, Google Domains, etc.)
- Find the DNS/Nameserver settings for your domain
- Replace the existing nameservers with Cloudflare's two nameservers
- Save changes — propagation takes 5 minutes to 48 hours (typically under 1 hour)
Important: Cloudflare must control your nameservers to proxy traffic through their network. If you can't change nameservers (some enterprise registrars restrict this), use the CNAME setup option instead.
Step 3: Configure DNS Records
After nameserver propagation, verify your DNS records in Cloudflare's dashboard:
| Type | Name | Value | Proxy Status |
|---|---|---|---|
| A | @ | Your server IP | ☁️ Proxied |
| A | www | Your server IP | ☁️ Proxied |
| CNAME | www | yourdomain.com | ☁️ Proxied |
| MX | @ | Your mail server | DNS only |
| TXT | @ | SPF/DKIM records | DNS only |
Proxy status "Proxied" (orange cloud) routes traffic through Cloudflare's CDN. "DNS only" bypasses Cloudflare — use this for mail servers and records that shouldn't be proxied.
Step 4: Configure SSL/TLS
SSL misconfiguration between Cloudflare and your origin server causes redirect loops, mixed content warnings, and broken sites. Set this correctly the first time:
- Go to SSL/TLS → Overview in the Cloudflare dashboard
- Set encryption mode to Full (Strict) — this requires a valid SSL certificate on your origin server
- Enable Always Use HTTPS under SSL/TLS → Edge Certificates
- Enable Automatic HTTPS Rewrites to fix mixed content
If you don't have an origin SSL certificate: Use Cloudflare's free Origin CA certificate:
- Go to SSL/TLS → Origin Server → Create Certificate
- Install the generated certificate on your origin server
- Set encryption mode to Full (Strict)
Never use "Flexible" SSL mode. It encrypts traffic between visitors and Cloudflare but sends unencrypted HTTP between Cloudflare and your server — creating a false sense of security and causing redirect loops with WordPress HTTPS plugins.
Step 5: Set Cache Rules for WordPress
Cloudflare's default behavior caches static assets (images, CSS, JS) but serves HTML dynamically from your origin. For WordPress, you want to cache full HTML pages for logged-out visitors while bypassing cache for admin and dynamic pages.
Create these Cache Rules (Cloudflare dashboard → Caching → Cache Rules):
Rule 1: Bypass cache for WordPress admin and dynamic pages
- When:
URI Path contains "/wp-admin"ORURI Path contains "/wp-login"ORCookie contains "wordpress_logged_in"ORURI Path contains "/cart"ORURI Path contains "/checkout"ORURI Path contains "/my-account" - Then: Bypass Cache
- Priority: 1 (highest)
Rule 2: Cache everything else
- When:
Hostname equals yourdomain.com - Then: Cache Everything, Edge TTL: 1 month, Browser TTL: 4 hours
- Priority: 2
Rule 3: Cache static assets aggressively
- When:
URI Path matches ".*\.(jpg|jpeg|png|webp|avif|gif|svg|css|js|woff2|woff|ttf)$" - Then: Cache Everything, Edge TTL: 1 year, Browser TTL: 1 year
- Priority: 3
These three rules cover 95% of WordPress caching needs. Static assets cache for a year (they're cache-busted by WordPress version strings on updates), full pages cache for a month at the edge, and admin/dynamic pages always hit your origin server.
Step 6: Enable Performance Settings
In the Cloudflare dashboard, enable these additional optimizations:
- Speed → Optimization → Auto Minify — minify HTML, CSS, and JavaScript (minor gains but free)
- Speed → Optimization → Brotli — enable Brotli compression (15–20% smaller than gzip)
- Speed → Optimization → Early Hints — sends
103 Early Hintsheaders so browsers start loading critical assets before the full HTML response - Speed → Optimization → HTTP/2 and HTTP/3 — enable both for multiplexed connections and reduced latency
- Caching → Tiered Cache — enable to reduce origin requests by caching at multiple Cloudflare tiers
Cache Purging Strategies
Cached content needs to be purged when you update your site — otherwise visitors see stale pages. There are three approaches:
Automatic Purging (Recommended)
Install the official Cloudflare plugin for WordPress or use WP Cloudflare Super Page Cache (free). These plugins automatically purge Cloudflare's cache when you:
- Publish or update a post/page
- Change theme settings
- Update menus or widgets
- Install/update plugins
The plugin sends a purge request to Cloudflare's API for the specific URLs that changed — without flushing the entire cache.
Manual Purging
In the Cloudflare dashboard: Caching → Configuration → Purge Everything clears the entire cache. Use this after major site changes (theme switches, migrations). For individual pages, use Custom Purge and enter specific URLs.
API-Based Purging
For automated deployments or CI/CD pipelines, use Cloudflare's API:
curl -X POST "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
--data '{"purge_everything": true}'
For individual URLs:
curl -X POST "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
--data '{"files": ["https://yourdomain.com/updated-page/"]}'
CDN Configuration for WooCommerce
WooCommerce adds complexity because it renders dynamic, user-specific content. Caching a checkout page means serving one user's cart to another. Caching a "My Account" page leaks personal data.
WooCommerce-specific cache bypass rules:
Bypass CDN caching for any request matching:
/cart//checkout//my-account/- Any URL containing
?add-to-cart= - Any request with the
woocommerce_cart_hashcookie - Any request with the
woocommerce_items_in_cartcookie
What you CAN cache on WooCommerce sites:
- Product pages (for logged-out visitors)
- Category/archive pages
- Static pages (about, contact, blog)
- All static assets (images, CSS, JS)
If you use WooCommerce with the Cloudflare cache rules above, the bypass rule (Rule 1) needs to include WooCommerce-specific paths and cookies. The wordpress_logged_in cookie bypass already covers logged-in customers, but cart cookies should be added explicitly to prevent edge cases where a visitor adds an item to cart without logging in.
Measuring CDN Impact: Before and After
Benchmark your site before enabling the CDN, then measure again 24 hours after (to ensure cache is warm). Here are typical results from WordPress sites we've configured at TopSyde:
Performance Benchmarks (Median of 50 Tests)
| Metric | Before CDN | After CDN | Improvement |
|---|---|---|---|
| TTFB (same region) | 380ms | 85ms | 78% faster |
| TTFB (cross-continent) | 890ms | 120ms | 87% faster |
| LCP (mobile) | 4.2s | 2.1s | 50% faster |
| Total page load | 5.8s | 2.4s | 59% faster |
| PageSpeed score (mobile) | 52 | 78 | +26 points |
| PageSpeed score (desktop) | 74 | 95 | +21 points |
| Monthly bandwidth (origin) | 120 GB | 18 GB | 85% reduction |
These numbers are from a content-heavy WordPress site (400+ pages, 2,000+ images) tested across 5 geographic regions before and after Cloudflare configuration with the cache rules described above. Individual results vary based on site size, existing optimization, and visitor distribution.
How to Benchmark
- Before enabling CDN: Run 5 tests on WebPageTest from different locations (Virginia, London, Tokyo, Sydney, São Paulo). Record TTFB, LCP, and total load time for each.
- Enable CDN with the configuration above
- Wait 24 hours for cache to warm across edge locations
- Re-run the same 5 tests from the same locations
- Compare results — focus on TTFB and LCP improvements
Use Google Search Console's Core Web Vitals report for real-user data over the following 28 days to confirm field improvements match lab results.
Common CDN Mistakes to Avoid
Caching logged-in user pages — This serves personalized content (admin bars, user names, cart items) to the wrong visitors. Always bypass cache when authentication cookies are present.
Using "Flexible" SSL mode — Creates redirect loops and a false sense of security. Always use "Full (Strict)" with a valid origin certificate.
Not purging after updates — Visitors see stale content. Configure automatic purging via the Cloudflare WordPress plugin.
Caching query string variations — URLs like ?utm_source=twitter and ?fbclid=abc create thousands of duplicate cache entries. Use Cloudflare's "Cache Key" settings to strip marketing parameters before caching.
Skipping mobile testing — CDN performance gains vary between desktop and mobile due to different connection speeds and device processing power. Always benchmark both.
When Managed Hosting Includes CDN
Configuring a CDN correctly takes 30 minutes for someone who's done it before, and several hours (with potential downtime) for someone who hasn't. SSL misconfigurations alone cause more support tickets than any other CDN-related issue.
TopSyde's managed WordPress hosting includes enterprise CDN integration with pre-configured cache rules, automatic purging on content updates, WooCommerce-compatible caching, and SSL that just works. Check our full spec sheet for infrastructure details, or get in touch if you want a hands-off CDN setup. Plans start at $89/month.
Frequently Asked Questions
Do I need a CDN if my audience is local?
Yes, but for different reasons. Even with a local audience, a CDN improves TTFB by serving cached content instead of executing PHP on every request. It also provides DDoS protection, SSL management, and bandwidth offloading. The performance gains from edge caching benefit every site regardless of geographic distribution.
Will a CDN break my WordPress site?
Not if configured correctly. The most common issue is SSL mode misconfiguration (redirect loops from "Flexible" mode) and caching logged-in user pages. Follow the cache bypass rules above — bypass for wp-admin, wp-login, and any request with WordPress authentication cookies — and use Full (Strict) SSL.
Is Cloudflare's free tier enough for WordPress?
For most sites, yes. The free tier includes unlimited bandwidth, 300+ edge locations, basic DDoS protection, and universal SSL. You miss Polish (image optimization), advanced WAF rules, and Argo Smart Routing — but these are optimizations on top of an already significant improvement. Upgrade to Pro ($20/mo) if you need image optimization or more than 3 page rules.
How does a CDN interact with WordPress caching plugins?
A CDN operates at the network layer — it caches and serves responses before they hit your server. WordPress caching plugins (WP Rocket, W3 Total Cache) operate at the application layer — generating and storing static HTML on your server. Both can coexist: the caching plugin generates the static HTML, and the CDN caches and distributes that HTML globally. You don't need both, but server-level + CDN caching is the fastest combination.
Should I use a CDN with WooCommerce?
Absolutely — but with careful cache bypass rules. Product pages, category pages, and blog content should be cached. Cart, checkout, and account pages must never be cached. The Cloudflare cache rules in this guide handle this by bypassing cache for WooCommerce-specific cookies and URL paths.
How do I know if my CDN is working?
Check the response headers in your browser's DevTools (Network tab). Look for cf-cache-status: HIT (Cloudflare) or the equivalent header for your CDN provider. A "HIT" means the response was served from the edge cache. A "MISS" means it was fetched from your origin server (expected on the first request). You can also compare TTFB in WebPageTest before and after — a working CDN will show dramatic TTFB reduction for all test locations.

DevOps & Security Lead
12+ years DevOps, Linux & cloud infrastructure certified
Marcus leads infrastructure and security at TopSyde, managing the server fleet and AI monitoring systems that keep client sites fast and protected. Former sysadmin turned WordPress hosting specialist.



