Prompt
How do I reduce page load time with a CDN?
Latest observation
Oct 4, 2026
OpenAI APIWeb search: off
A CDN can reduce page load time by serving your static assets from servers closer to your users and by offloading traffic from your origin server.
What to put on a CDN
Typically:
- Images
- CSS
- JavaScript
- Fonts
- Video/audio files
- Other static files (PDFs, downloads)
How it helps
- Lower latency: Users download files from an edge server near them.
- Less origin load: Your main server handles fewer requests.
- Better caching: Repeated requests can be served instantly from cache.
- Improved global performance: Especially helpful for international users.
How to use a CDN effectively
-
Move static assets to the CDN
- Change asset URLs to the CDN domain.
- Example:
https://cdn.example.com/images/logo.png
-
Set proper cache headers
- Use long cache times for versioned files:
Cache-Control: public, max-age=31536000, immutable
- For files that change often, use shorter cache times or cache revalidation.
- Use long cache times for versioned files:
-
Version your assets
- Use file names or query strings like:
app.4f3c2.jsstyles.v12.css
- This lets you cache aggressively without serving stale content.
- Use file names or query strings like:
-
Enable compression
- Use Brotli or gzip for text assets like HTML, CSS, JS.
-
Optimize images
- Serve modern formats like WebP or AVIF when possible.
- Resize images to the size actually displayed.
-
Use HTTP/2 or HTTP/3
- Many CDNs support these by default and they improve delivery performance.
-
Avoid putting dynamic HTML on a CDN unless configured for it
- CDNs are best for static or semi-static content.
- For dynamic pages, use edge caching carefully if needed.
Common mistakes
- Caching everything with no invalidation plan
- Forgetting to update asset URLs
- Serving uncompressed assets
- Putting large unoptimized images on the CDN without resizing
- Not measuring before and after
How to measure improvement
Track:
- Time to First Byte (TTFB)
- Largest Contentful Paint (LCP)
- Total page load time
- Cache hit ratio
- Origin request volume
If you want, I can also show you:
- a step-by-step CDN setup
- how to do it for WordPress / React / Next.js
- or how to configure cache headers correctly.