
A WordPress site that takes longer than 3 seconds to load loses more than 53% of visitors according to Google research. Google also factors Core Web Vitals into rankings, making speed a direct SEO signal. A CDN (Content Delivery Network) has become essential for any WordPress site that needs strong performance.
This guide explains what a CDN is, why it speeds up WordPress, and walks you through setting up Cloudflare CDN step by step — including integration with popular cache plugins and automatic cache purging.
What Is a CDN in the WordPress Context?
A CDN is a network of servers distributed globally that stores cached copies of static files — images, CSS, JavaScript — from your website, then delivers them to visitors from the server geographically nearest to them.
Example: if your WordPress is hosted in Bangkok but a visitor comes from Japan, without a CDN they receive files from Bangkok (high latency). With a CDN, a copy sits at a Tokyo data center, loading far faster.
- Origin Server — Your main WordPress hosting server (e.g., AsiaGB Hosting)
- Edge Server (PoP) — CDN servers distributed globally that serve files to users
- Cache — File copies stored at Edge Servers, reducing load on your Origin
Why CDN Makes WordPress Faster
A typical WordPress site contains many static files — images, fonts, CSS, JavaScript — that load on every page view. A CDN helps in three key ways:
- Reduces Latency — Files are served from the nearest Edge Server rather than pulled from Origin each time
- Reduces Origin Server Load — With static files offloaded to CDN, the Origin has more resources for PHP execution and MySQL queries
- Handles Traffic Spikes — CDN infrastructure absorbs large concurrent traffic without impacting your Origin
- HTTP/2 and HTTP/3 Support — Most CDNs support the latest protocols which are significantly faster than HTTP/1.1
Real numbers: Testing Cloudflare CDN on a mid-size WordPress site shows average page load time reductions of 40–60% for international visitors.
CDN and Core Web Vitals: The SEO Connection
Google confirmed that Core Web Vitals became a ranking signal in 2021 and remains critical through 2026. A CDN directly improves three Core Web Vitals metrics for WordPress sites.
Largest Contentful Paint (LCP)
LCP measures how long it takes the largest visible element on the page (usually a hero image or main heading) to load. The goal is LCP ≤ 2.5 seconds. CDN improves LCP by:
- Serving images from Edge Servers near the user, reducing latency by 40–70ms per round-trip
- Supporting modern image formats like WebP and AVIF, which are 25–35% smaller than JPEG
- Leveraging HTTP/2 Server Push and Early Hints to pre-deliver critical resources before the browser requests them
First Input Delay (FID) / Interaction to Next Paint (INP)
CDN helps reduce JavaScript execution time by delivering pre-minified JS files from edge cache faster. This frees up the browser's main thread sooner. A good INP score is ≤ 200ms.
Cumulative Layout Shift (CLS)
CDN does not directly fix CLS, but faster delivery of fonts and CSS from edge cache allows the browser to compute the correct layout earlier, reducing layout shifts caused by late-loading fonts.
PageSpeed tip: In Google PageSpeed Insights, look for "Serve static assets with an efficient cache policy." If your CDN is set up correctly, static assets should show a Cache-Control header of at least one year (31,536,000 seconds).
Popular Free CDN Options for WordPress
1. Cloudflare (Free — Most Recommended)
Cloudflare is the most popular CDN for WordPress because the free plan includes CDN, DDoS protection, SSL, firewall, and even has an Edge Server in Bangkok, Thailand.
- 300+ PoP locations worldwide including Bangkok
- Free plan: CDN + SSL + Basic Firewall + DDoS Protection
- Setup requires changing your domain's nameservers
- Works excellently with LiteSpeed Cache, WP Rocket, W3 Total Cache
2. BunnyCDN (Cheapest for High Traffic)
BunnyCDN offers pay-as-you-go pricing at approximately $0.01/GB with no monthly minimum. Ideal for sites wanting CDN via Pull Zone without changing nameservers.
- Pricing: $0.01–$0.03/GB depending on region
- Southeast Asian PoP in Singapore
- Configured as a Pull Zone pointing to your origin
- Integrates with WP Rocket and CDN Enabler plugin
3. Statically (Free for Static Assets)
Statically is a completely free CDN focused on static assets like images, CSS, and JS. No signup required — just change asset URLs to go through the CDN endpoint.
- 100% free for static assets
- No account needed, works immediately
- Best for small sites needing only image CDN
CDN Options Compared: 2026 Overview
Before choosing a CDN, compare features and pricing to match your site's needs. The table below summarizes the main options for WordPress sites:
| CDN | Pricing | Asia PoP | Setup | Best For |
|---|---|---|---|---|
| Cloudflare Free | Free | Bangkok (BKK PoP) | Change NS | All site sizes |
| BunnyCDN | $0.01–0.03/GB | Singapore | Pull Zone URL | High traffic |
| Statically | Free | Multiple Asia | Rewrite URLs | Small static-only |
| KeyCDN | $0.04/GB (Asia) | Singapore, Tokyo | Pull/Push Zone | Developers |
For WordPress sites hosted at AsiaGB Hosting in Thailand, Cloudflare Free is the recommended first choice. The Bangkok PoP delivers exceptionally low latency for Thai users, with no cost involved.
Step-by-Step: Setting Up Cloudflare CDN with WordPress
Step 1: Create a Cloudflare Account and Add Your Domain
- Go to cloudflare.com and sign up for a free account
- Click Add a Site and enter your domain, e.g.,
example.com - Select the Free plan
- Cloudflare automatically scans your existing DNS records — verify they are all correct
Step 2: Change Your Nameservers
Cloudflare provides two new nameservers such as aria.ns.cloudflare.com and brad.ns.cloudflare.com. Update these at your domain registrar.
- Log in to your registrar (e.g., AsiaGB, Namecheap)
- Navigate to DNS / Nameserver settings for your domain
- Replace the nameservers with the two values Cloudflare provides
- Wait 1–48 hours for DNS propagation (usually much faster)
Important: Before changing nameservers, confirm Cloudflare imported all DNS records correctly — especially MX records for email. Missing MX records will break incoming email after the nameserver change.
Step 3: Configure SSL/TLS Mode
In Cloudflare Dashboard, go to SSL/TLS → Overview and select the correct mode:
- Full (Strict) — Most recommended. Requires a valid SSL certificate on the Origin (AsiaGB provides one free)
- Full — SSL on Origin but no certificate validation check
- Flexible — Do NOT use if you already have SSL, as it causes redirect loops
Step 4: Configure Cache Rules for WordPress
Cloudflare does not cache dynamic PHP content by default, but automatically caches images and static files. Add Page Rules or Cache Rules to bypass cache on WordPress Admin:
# Page Rule: Bypass Cache for WordPress Admin
# URL Pattern:
yourdomain.com/wp-admin/*
# Setting:
Cache Level: Bypass
# Page Rule: Aggressive Cache for Static Files
yourdomain.com/wp-content/*
# Setting:
Cache Level: Cache Everything
Edge Cache TTL: 1 month
Step 5: Enable Helpful Cloudflare Features
- Auto Minify (Speed → Optimization) — Enable for JavaScript, CSS, HTML
- Brotli Compression — Enable in Speed → Optimization
- Rocket Loader — Defers JavaScript loading to prioritize HTML (test carefully; may conflict with some plugins)
- Early Hints — Helps browsers pre-load resources
Configuring Cache Headers Correctly for WordPress CDN
For a CDN to perform well, your Origin server must return correct Cache-Control headers. Without them, the CDN either will not cache content at all or caches it for too short a time.
Check Current Cache Headers
Use curl to inspect the response headers from your origin:
curl -I https://yourdomain.com/wp-content/themes/mytheme/style.css
Headers you should see (when a cache plugin is configured correctly):
Cache-Control: public, max-age=31536000
Expires: [date one year in the future]
Vary: Accept-Encoding
Set Cache Headers via .htaccess
If your plugin does not set headers automatically, add the following to your WordPress .htaccess file:
<IfModule mod_expires.c>
ExpiresActive On
# Images: cache for 1 year
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
# CSS / JavaScript: cache for 1 month
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
# Fonts: cache for 1 year
ExpiresByType font/woff2 "access plus 1 year"
</IfModule>
<IfModule mod_headers.c>
# Force public cache for static files
<FilesMatch "\.(css|js|jpg|jpeg|webp|png|gif|svg|woff2)$">
Header set Cache-Control "public, max-age=31536000"
</FilesMatch>
# Never cache PHP (dynamic content)
<FilesMatch "\.php$">
Header set Cache-Control "no-cache, no-store, must-revalidate"
</FilesMatch>
</IfModule>
Important: Always use versioning or cache-busting when updating CSS/JS files. For example, append ?ver=2.1 to the URL. With a one-year cache and no versioning, visitors will continue seeing old files until the cache naturally expires.
Verify CDN Cache Status
After configuration, verify that Cloudflare cache is active:
curl -I https://yourdomain.com/wp-content/themes/mytheme/style.css | grep -i "cf-cache"
# cf-cache-status: HIT → CDN cache is working
# cf-cache-status: MISS → CDN has not cached yet (first request)
# cf-cache-status: BYPASS → CDN is skipping cache (check Page Rules)
WordPress Plugins That Work with CDN
LiteSpeed Cache (Recommended for AsiaGB Hosting)
LiteSpeed Cache works best with LiteSpeed Web Server (used on AsiaGB Hosting). It includes built-in CDN integration supporting Cloudflare and others.
- Set CDN URL in LiteSpeed Cache → CDN → CDN URL
- Supports Cloudflare API for automatic cache purging on post updates
- Includes Image Optimization, CSS/JS Minify, and Critical CSS
WP Rocket (Premium — Most Comprehensive)
WP Rocket is the most popular premium cache plugin with full CDN integration for Cloudflare, BunnyCDN, and others. Easy to configure and consistently outperforms most free alternatives.
- Price: $59/year for 1 site
- Cloudflare Integration: automatic cache purge, Development Mode toggle
- BunnyCDN support via URL rewriting
Purging CDN Cache After WordPress Updates
When you publish or update a post, the CDN may still serve cached old content. You need to purge the cache so the CDN fetches fresh content from your Origin.
Purge via Cloudflare Dashboard
- Log in to Cloudflare and select your domain
- Go to Caching → Configuration
- Click Purge Everything or Custom Purge for specific URLs
Automatic Purge with Plugins
LiteSpeed Cache and WP Rocket both support Cloudflare API integration for automatic cache purging on every post publish or update.
- LiteSpeed Cache → CDN → enter Cloudflare API Key + Zone ID
- WP Rocket → CDN → Cloudflare Section → enable "Enable Cloudflare"
Common CDN Problems with WordPress and How to Fix Them
Setting up CDN with WordPress can surface unexpected issues. Knowing the most common problems and their fixes in advance will save considerable troubleshooting time.
Problem 1: Mixed Content Warning (HTTP + HTTPS)
After enabling Cloudflare CDN with HTTPS, browsers sometimes show a "Mixed Content" warning because WordPress is still loading some resources over HTTP.
- Cause: URLs stored in the WordPress database still start with
http://. - Fix: Use the "Really Simple SSL" or "SSL Insecure Content Fixer" plugin to update all URLs to HTTPS.
- Or run a SQL query:
UPDATE wp_options SET option_value = replace(option_value, 'http://', 'https://') WHERE option_name IN ('siteurl', 'home');
Problem 2: Redirect Loop (ERR_TOO_MANY_REDIRECTS)
This typically happens when Cloudflare SSL Mode is set to "Flexible" while your origin already has SSL.
- Cause: Cloudflare (Flexible) → HTTP → Origin → 301 HTTPS → Cloudflare → HTTP → infinite loop.
- Fix: Change Cloudflare SSL Mode to "Full" or "Full (Strict)" immediately.
Problem 3: WordPress Admin Is Slow or Login Fails
This occurs when Cloudflare caches admin pages.
- Fix: Add a Cache Rule set to "Bypass" for
/wp-admin/*and/wp-login.php. - Cloudflare also automatically bypasses cache when it detects a WordPress login cookie (
wordpress_logged_in_*).
Problem 4: Updated Images Still Showing the Old Version
The CDN has cached the old image and does not automatically fetch the updated version from origin.
- Quick fix: Purge the specific image URL from the Cloudflare Dashboard.
- Permanent fix: Use file versioning in image filenames, e.g., rename to
hero-image-v2.jpgwhen replacing an image.
Problem 5: E-Commerce Checkout Issues
WooCommerce checkout or payment pages may fail because the CDN caches these dynamic pages.
- Fix: Add Bypass Cache rules for
/cart/*,/checkout/*, and/my-account/*. - LiteSpeed Cache and WP Rocket include WooCommerce settings that automatically bypass dynamic pages.
Measuring Results with PageSpeed Insights
After configuring CDN, measure your results with Google PageSpeed Insights (pagespeed.web.dev) or GTmetrix to compare before and after.
Key metrics to check after enabling CDN:
- Time to First Byte (TTFB) — Should decrease for static content
- Largest Contentful Paint (LCP) — Hero images load faster
- Cache-Control Headers — Look for
cf-cache-status: HITin response headers - Total Page Size — Should decrease with Minify and Compression enabled
Pro tip: Open Chrome DevTools → Network tab and check response headers on CSS/JS files. If you see cf-cache-status: HIT, Cloudflare CDN is working correctly.
Fast WordPress Hosting with Cloudflare CDN Support
AsiaGB Hosting fully supports Cloudflare CDN, using DirectAdmin, SSD storage, free SSL, and 99% Uptime. Starting at 500 THB/year with no hidden fees.
View Hosting Plans →