Website caching can make a site feel fast, reduce pressure on your hosting server, and improve the consistency of repeated visits. It can also make a recent deployment appear broken when an old page, stylesheet, image, or API response is still being served. This guide explains how website caching works across the browser, server, application, object, and CDN layers; what to monitor; how to clear or configure each layer; and when to revisit your setup after changes.
Overview
Caching stores a reusable copy of content so it does not need to be generated or transferred from the origin on every request. The result may be faster delivery, lower origin workload, and more predictable performance. A cache is not a single feature, however. Most websites use several caching layers at once.
The main layers are:
| Layer | What it stores | Typical control | Common risk |
|---|---|---|---|
| Browser cache | Files such as CSS, JavaScript, images, and sometimes documents | Cache-Control, expiration, validation requests | A visitor sees an older asset after an update |
| Page or full-page cache | Rendered HTML responses | CMS, plugin, hosting panel, or reverse proxy | Logged-in or personalized content is cached incorrectly |
| Object cache | Reusable application data, queries, and settings | Application configuration or hosting service | Old data remains after an update |
| Server or reverse-proxy cache | Responses close to the web server or application gateway | Web server or managed hosting configuration | Origin changes do not appear immediately |
| CDN cache | Copies of cacheable files or responses at edge locations | CDN rules, headers, and purge or invalidation tools | Different visitors receive different versions temporarily |
Browser cache and CDN cache are related but not interchangeable. A CDN can be purged centrally, but a file already stored in a visitor's browser may remain until its browser cache expires or the URL changes. Similarly, clearing a WordPress page-cache plugin does not necessarily clear the CDN or browser cache.
A practical caching policy separates content by how often it changes. Fingerprinted assets such as app.8f31c.js can usually receive a longer cache lifetime because a new filename identifies a new version. HTML documents, account pages, checkout flows, and API responses often need shorter lifetimes or explicit instructions not to store them.
What to track
Track both performance and freshness. A site that is fast but serves outdated content is not operating correctly, while a site that is always fresh but repeatedly rebuilds the same response may waste resources.
1. Cache status and hit behavior
Where your platform exposes it, review response headers such as Age, ETag, Last-Modified, and a provider-specific cache-status header. A cache hit generally means the response was served from a cache; a miss means the request went further toward the origin. Do not assume that every provider uses the same header name or status wording.
Compare a first request with a repeat request from an independent session. Test the page at the CDN layer and at the origin when your hosting setup allows it. A high hit rate is not automatically desirable if private or rapidly changing content is being cached incorrectly.
2. Cache-Control directives
Inspect the response headers for each important content type. A simple example for a versioned static asset is:
Cache-Control: public, max-age=31536000, immutableThis pattern is appropriate only when the URL changes whenever the file changes. For HTML that may change after a deployment, a shorter lifetime or revalidation policy is safer. For private user-specific responses, consider directives such as private or no-store according to the application's needs. Treat examples as starting points; confirm that your framework, hosting layer, and CDN interpret them as intended.
3. Freshness after common changes
Keep a small change log and test these events:
- Publishing or editing a page
- Replacing a CSS, JavaScript, image, or font file
- Changing redirects, canonical URLs, or structured data
- Updating a CMS, theme, plugin, or application dependency
- Changing DNS, CDN, TLS, or origin settings
- Deploying from staging to production
For each event, record when the change was visible through the public URL, whether the origin showed the new version, and which purge or invalidation action was required. This turns “the cache is stale” into a repeatable diagnostic process.
4. User-facing performance
Monitor representative pages rather than only the homepage. Check document response time, asset transfer, page weight, cache status, and your selected real-user or lab performance indicators. Caching can improve delivery while another change—such as an oversized image, a blocking script, or a slow database query—still harms the experience. For a broader performance review, use the Core Web Vitals troubleshooting guide.
Cadence and checkpoints
A lightweight schedule is enough for many sites if it is combined with checks after deployments.
After every deployment or content release
- Open the public URL in a private or clean browser session.
- Confirm the page title, main content, links, images, styles, and scripts.
- Inspect response headers and verify that the expected version is being served.
- Check one important page from a second network or location if a CDN is involved.
- Purge only the affected paths where possible, rather than clearing the entire cache by default.
If the release contains renamed assets, confirm that the HTML references the new filenames and that old assets are not being requested by a stale document.
Monthly checkpoint
Review a short list of representative URLs: the homepage, a high-traffic landing page, a recently edited page, a form or transaction path, and a page that should not be cached. Verify cache headers, response behavior, redirects, and performance. Check whether any purge rules have become too broad or whether a cache exception is creating unnecessary origin requests.
Quarterly checkpoint
Review the overall policy. Ask whether HTML lifetimes still match the publishing workflow, whether static files use reliable versioning, and whether personalized pages are excluded. Re-test cache behavior after hosting, CMS, CDN, or reverse-proxy changes. If your team uses a staging environment, follow the deployment process described in this staging website guide and include cache validation before production release.
Automated checks
For critical sites, schedule checks for uptime, response codes, key headers, and a small set of page-content markers. An automated check can detect a broken origin or an unexpected response, but it should not rely on one cache location alone. See the website uptime monitoring and incident runbook for a structured monitoring approach. A scheduled check can be managed with a suitable cron job; the cron expression guide covers the scheduling side.
How to interpret changes
When visitors report stale content, identify the oldest layer first. Request the page with a cache-busting query string only as a diagnostic step, not as a permanent fix. Compare the normal URL, the origin response, and the CDN response. Then inspect the document's asset URLs.
Use this sequence:
- Confirm the symptom: determine exactly what is old—the HTML, an image, a stylesheet, a script, an API response, or a redirect.
- Check the origin: if the origin is old, fix the deployment or application before purging downstream caches.
- Check the server and page cache: clear or rebuild the relevant application cache.
- Check the CDN: purge the affected URL or path, respecting any provider-specific propagation behavior.
- Check the browser: use a clean session, then confirm whether the normal browser still has an old asset.
- Check personalization: make sure cookies, authorization, locale, and query parameters are not causing a private response to be reused.
Do not solve every stale asset problem with a full-site purge. Broad purges can create a surge of requests to the origin when all objects must be rebuilt. Prefer precise invalidation, short-lived HTML, and versioned asset filenames. If content is wrong only for signed-in users, treat it as a cache-safety issue rather than a simple freshness issue.
Cache behavior can also affect SEO foundations. An outdated canonical tag, redirect, robots directive, structured-data block, or page title may remain visible to crawlers or users until the correct response is available. After a significant technical change, validate the live response—not only the source file in your deployment system.
When to revisit
Revisit this guide monthly for a basic health check and quarterly for a policy review. Return immediately after a redesign, domain or DNS change, CDN migration, hosting move, CMS or plugin update, caching-rule change, or deployment pipeline adjustment. Also investigate whenever visitors report old content, a page looks unstyled, a script fails after release, or performance changes without an obvious code change.
Keep a short cache runbook with the cache layers in use, ownership of each layer, standard headers, excluded paths, purge instructions, and a verification checklist. Update it when your hosting panel, CDN terminology, deployment workflow, or application architecture changes. Pair caching with backups and recovery planning; the website backup and disaster recovery guide can help define that separate control.
For your next review, choose five representative URLs, record their response headers, publish one controlled test change, and document how long each layer takes to reflect it. That small exercise will show whether your current caching setup is fast, safe, and predictable—and will give you a baseline to compare after the next release.