How to Serve Your Website Through a CDN Near Your Audience

This check reads the HTTP response headers of your homepage and looks for a recognizable CDN signature, such as Cloudflare's cf-ray, CloudFront's x-amz-cf-id or a generic x-cache header. If none appears, your pages are probably served from a single origin server, however far away your visitors are. By the end of this guide your homepage will be served through a CDN edge network, and you will have confirmed it from the headers.

By Updated ⏱ 30-60 minutes, plus up to 24 hours for DNS changes🎯 Intermediate● Low impactTechnical
Illustration: CDN / hosting location fix guide
TECHNICAL · FIX GUIDE CDN / hosting location IMPACTEFFORT TIME30-60 minutes, plus up to 24 hours for DNS changes LEVELIntermediate

Why it matters

A visitor in Sydney loading a site hosted only in Frankfurt pays roughly 250-300 ms of extra round-trip time on every uncached request, before the server does any work. That raises Time to First Byte and Largest Contentful Paint, which feed Google's page experience signals and decide whether people stay or leave. A CDN also absorbs traffic spikes and basic DDoS floods, and keeps serving cached pages when the origin is briefly down.

Crawlers, including AI answer engines, get faster and more reliable fetches. The SEO impact is small on its own, but the user-facing speed gain is easy to see on mobile and international traffic.

✕Beforecurl -sI https://example.com returnsonly server: nginx and content-type,with no cf-ray, x-cache, x-amz-cf-id✓Aftercurl -sI https://example.com returnscf-ray: 8f2a1c3d4e5f6a7b-LHR (orx-cache: Hit from cloudfront), showing

What you need

Access to your domain registrar or DNS provider
Admin access to your hosting or server configuration
A terminal with curl, or browser DevTools
Your analytics showing where visitors are located

Step-by-step fix

1

Inspect your current homepage headers

Check what your homepage sends today before changing anything. The audit only looks at the homepage, so test the exact URL visitors land on, both the apex domain and www. If you already see one of the headers below, a CDN is in place and the issue may only be that one hostname bypasses it.

text
curl -sIL https://example.com | grep -iE 'cf-ray|x-amz-cf-id|x-amz-cf-pop|x-vercel-id|x-nf-request-id|x-served-by|x-fastly-request-id|x-akamai|x-cache|cdn-cache-control|^server'
curl -sIL https://www.example.com | grep -iE 'cf-ray|x-cache|^server'
Pro tip: The -L flag follows redirects. If example.com redirects to www.example.com, the final response is the one that matters.
2

Pick a CDN that matches your audience and stack

Open Google Analytics (Reports > User attributes > Demographic details, by Country) to see where traffic comes from. Then choose the simplest option for your setup:

  • Cloudflare (free plan): proxies your whole domain after a nameserver change. This is the easiest path for most sites.
  • Amazon CloudFront: a good fit if you already host on AWS.
  • Your host's built-in CDN: Kinsta, WP Engine, SiteGround, Vercel and Netlify include one, often as a single toggle.

Check that the provider has points of presence in your top visitor countries.

Pro tip: If your host offers a one-click CDN, start there. It avoids DNS migration and SSL mismatches.
3

Add the domain to Cloudflare and proxy it

com, choose the Free plan and let Cloudflare import your DNS records. Review the imported records against your current DNS so that nothing is missing, especially MX and TXT records for email. For the A/AAAA or CNAME records for @ and www, set Proxy status to Proxied (orange cloud).

A record left as DNS only (grey cloud) bypasses the CDN, and no cf-ray header will be sent.

text
Type   Name   Content         Proxy status
A      @      203.0.113.10    Proxied
CNAME  www    example.com     Proxied
MX     @      mail.example.com  DNS only
Pro tip: Mail, SSH and FTP hostnames must stay DNS only, because Cloudflare's proxy only handles HTTP/HTTPS.
4

Switch nameservers and set SSL to Full (strict)

At your registrar, replace the existing nameservers with the two Cloudflare assigns, for example ada.ns.cloudflare.com and bob.ns.cloudflare.com. In Cloudflare, go to SSL/TLS > Overview and choose Full (strict), which requires a valid certificate on your origin (Let's Encrypt works). Avoid Flexible: it causes redirect loops on sites that already force HTTPS.

Pro tip: Lower your DNS TTL to 300 seconds a day before switching. Propagation then takes minutes instead of hours.
5

Alternative: put CloudFront in front of your origin

In the AWS Console, open CloudFront > Distributions > Create distribution. com, and Viewer protocol policy to Redirect HTTP to HTTPS. For the cache policy, use CachingOptimized for static sites, or UseOriginCacheControlHeaders for dynamic ones.

com under Alternate domain names, attach an ACM certificate issued in us-east-1, then point DNS at the distribution with a CNAME, or with an ALIAS/A-alias for the apex.

text
www.example.com.  300  IN  CNAME  d1a2b3c4d5e6f7.cloudfront.net.
Pro tip: Choose a Price Class that covers your audience's regions. Price Class 100 excludes most of Asia, South America and Oceania.
6

Let the CDN cache your pages, not just assets

A CDN that only proxies requests still saves TLS round trips, but the full speed gain comes from caching HTML at the edge. Send explicit cache headers from your origin. You can also add a CDN-Cache-Control header (RFC 9213), which sets a longer edge cache without changing browser caching.

On Cloudflare, cache HTML with a Cache Rule (Caching > Cache Rules, Eligible for cache) that excludes logged-in, cart and admin paths.

nginx
location / {
    add_header Cache-Control "public, max-age=0, must-revalidate";
    add_header CDN-Cache-Control "public, max-age=600";
}
location ~* \.(css|js|woff2|webp|avif|png|jpg|svg)$ {
    add_header Cache-Control "public, max-age=31536000, immutable";
}
Pro tip: Never cache pages that set session cookies. Bypass caching for /wp-admin, /cart, /checkout and /account.
7

Expose a cache header if your CDN hides itself

Some CDNs, and some white-labelled host CDNs, do not send any of the commonly recognized headers. If your site is on a CDN but still isn't detected, look at the CDN's settings for an option to add an X-Cache response header, or create an edge rule that adds one. It also helps your own debugging, because it shows HIT or MISS on every request.

text
X-Cache: HIT
Pro tip: Only add this header at the CDN edge, never at your origin. Otherwise it would report a CDN that isn't there.
8

Verify the CDN headers and the edge location

Re-run the header check on both hostnames. Look for cf-ray (the three-letter suffix is the airport code of the edge, such as -LHR or -SIN), x-amz-cf-pop, x-vercel-id or x-cache. Then run a TTFB test from several regions to confirm that distant visitors now get faster responses.

text
curl -sI https://example.com | grep -iE 'cf-ray|x-amz-cf-pop|x-cache|cf-cache-status|x-vercel-id'
curl -o /dev/null -s -w 'TTFB: %{time_starttransfer}s\n' https://example.com
Pro tip: Run the TTFB command twice. The first request may be a MISS; the second should show cf-cache-status: HIT or x-cache: Hit.

Platform-specific notes

WordPress

Managed hosts such as Kinsta, WP Engine and Rocket.net put Cloudflare in front automatically or via a dashboard toggle (e.g. Kinsta > Sites > CDN). On other hosts, use Cloudflare with the APO add-on, or a Cache Rule that bypasses requests with wordpress_logged_in_ and woocommerce_ cookies. Purge the Cloudflare cache after theme changes.

Shopify

Every Shopify storefront is served through Shopify's Cloudflare-based edge, so cf-ray is normally present and nothing needs to be done. Do not put a second Cloudflare proxy in front of Shopify; it breaks SSL and checkout.

Next.js / Vercel / Netlify

Deploying to Vercel or Netlify serves pages from their edge networks automatically (x-vercel-id or x-nf-request-id headers). On a self-hosted Next.js server running next start, put Cloudflare or CloudFront in front and keep the Cache-Control headers Next.js sets for /_next/static.

Wix / Squarespace / Webflow

These platforms run their own CDNs, and you cannot swap in your own. Webflow sites typically show Cloudflare or Fastly headers. If Wix or Squarespace is flagged, the content is still served from a CDN that this check can't recognize; you can treat the warning as informational.

Self-hosted Nginx / Apache

Leave the server where it is and add Cloudflare (nameserver change) or CloudFront (CNAME) in front. Restore real visitor IPs in logs: on Nginx use real_ip_header CF-Connecting-IP with set_real_ip_from for Cloudflare's ranges; on Apache use mod_remoteip.

Check that it worked

✅ How to verify

  • Run curl -sIL https://example.com and confirm a CDN header appears: cf-ray, x-amz-cf-id, x-vercel-id, x-nf-request-id, x-fastly-request-id, x-cache or cdn-cache-control.
  • In Chrome DevTools > Network, reload the homepage, click the document request and check the Response Headers for the same values; do this for both example.com and www.example.com.
  • Test TTFB from several regions with a multi-location speed tool. Visitors far from your origin should now see noticeably lower TTFB on repeat requests.
  • Re-run the audit and confirm it reports "Served via" followed by your CDN's name.

⚠️ Common mistakes

  • Leaving the apex or www record as DNS only (grey cloud) in Cloudflare, so the homepage bypasses the proxy and no CDN header is returned.
  • Using Cloudflare's Flexible SSL mode on a site that already redirects to HTTPS, which causes ERR_TOO_MANY_REDIRECTS.
  • Caching full HTML pages without excluding cart, checkout, account and admin URLs, so one user's session content is served to others.
  • Forgetting to move MX and TXT records during the nameserver switch, which breaks email and domain verification.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Do I need a CDN if my audience is all in one country?

If your server is in or near that country, the latency gain is small. You still get edge caching, TLS termination close to users, DDoS protection and resilience during traffic spikes. Cloudflare's free plan costs nothing, so the trade-off usually favours using one.

Does server location affect SEO rankings?

Not directly. Google relies on ccTLDs, hreflang and content to judge geographic relevance, not on server IP location. Speed does matter: a slow TTFB for your main audience hurts Core Web Vitals and engagement, and a CDN fixes that whatever country your origin is in.

How do I tell which CDN edge served my page?

Check the response headers. Cloudflare's cf-ray ends in an airport code such as -FRA or -NRT, CloudFront sends x-amz-cf-pop with a similar code, and Fastly's x-served-by lists cache node names. Cloudflare also shows the colo= value at https://example.com/cdn-cgi/trace.

Will adding Cloudflare cause downtime?

Usually not, provided all DNS records are imported correctly and SSL is set to Full (strict) with a valid origin certificate. During propagation some visitors reach the origin directly and others go through Cloudflare, and both paths serve the same site.