Skip to main content

Insight · Hosting, Servers, CDN & Caching

Cleanly separating CDN caching and browser caching

CDN and browser caching are separate caching levels: Directives for shared and private storage, as well as clear durations, must be deliberately separated.

For system administrators and web developers, "Managing CDN and Browser Caching Separately" shows the difference between "Storage Instance" and "Variation Scope." "Data mixing" is the typical warning sign.

Published: 3 min read · Author:

Which cache rules differ between the CDN and the user's browser?

Browser caches are user-specific, while CDNs share responses between requests. Therefore, cache control, S-maxage, private, Vary, and authentication must be consciously combined for each piece of content.

Variant scope

  1. Organize response classes as public, private, versioned, and dynamic.

  2. Define browser and shared cache rules, as well as relevant variants, separately.

  3. Test hits, revalidation, and private responses in the browser, CDN, and Origin.

Storage instance

Test criterion

Storage instance

For each response, it is clear whether the browser, CDN, or both are allowed to store the data.

Test criterion

Variant scope

Language, compression, and other relevant differences are represented in the key.

  • Personalization Private or logged-in content is not stored in a shared cache.

Data mixing

  • Data mixing A CDN delivers a personalized response to another request, thereby exposing session- or user-related content.

  • Stale browsers The CDN is cleared, but long browser runtimes retain old HTML content.

  • Vary explosion Unlimited header values ​​destroy hit rates and predictability because almost every request receives its own cache key.

Use case: "Data mixing"

A versioned script may remain in the browser and CDN for an extended period, while the HTML page revalidates briefly. A logged-in account area has the directive `Cache-Control: private`; a CDN hit for this content is considered an error, even if the response is technically fast.

Personalization

  • Cache hits, misses, and bypasses at each browser, CDN, and origin level, as well as by response class.

  • Incorrectly shared or unexpectedly old responses based on header combinations.

What questions remain after "Controlling CDN and Browser Caching Separately"

Maintaining Correct File Permissions and Ownership on Web Servers delves deeper into the "Storage Instance" checklist. The key question is: What ownership and permissions distribution protects web server files without blocking operation?

A complementary perspective is offered Define cache runtimes based on file type and change risk.It answers the question: "How do you define cache runtimes based on file type and change risk?"

If you want to practically implement "Controlling CDN and Browser Caching Separately," you can refer to Robust Website Systems This document focuses on "HTTP and CDN Caching" and "Storage Instance."

Conclusion: Control CDN and Browser Caching Separately

Browsers and CDNs have different trust and life spaces. Good headers explicitly define these differences and prevent the sharing of private responses.

Sources and Further Information

The classification of "controlling CDN and browser caching separately" is based on the following official documentation and standards.

  • RFC 9110: HTTP SemanticsThe standard provides the semantics for methods, status codes, fields, validators, variants, and intermediaries.

  • RFC 9111: HTTP CachingThe Internet standard defines storage, freshness, revalidation, directives, and security requirements for HTTP caches.

Key Thesis

The browser cache is user-specific, while a CDN shares responses among many requests. Therefore, cache control, `s-maxage`, `private`, `Vary`, and authentication must explicitly define for each response who is allowed to store the cache and for how long.

What This Is Not About

A cache duration does not automatically apply equally to a person's browser and a shared Edge cache.

What it's about

Response headers separately determine who is allowed to store a representation and which variants modify the cache key.

More insights

Hosting, servers, CDN & caching

Delivering Static Assets with Long Runtimes and Version Parameters

"Controlling CDN and browser caching separately" includes, as a separate check, the question: How do you reconcile long cache runtimes with immediately visible changes to static assets?

Hosting, servers, CDN & caching

Plan DNS changes during migrations without unnecessary downtime.

"Controlling CDN and browser caching separately" is supplemented by a separate decision: How do you plan DNS changes when cached responses don't disappear immediately?

Insights Overview

All VELUNO Insights at a Glance

Further analyses on Website Systems, digital visibility, and robust working models.

Practical Implications

Personalization: practical next check

Three response classes are sufficient for an initial header check: HTML, versioned asset, and logged-in page. Their behavior is tracked at both cache levels.