Resources · 63

HTTP caching: protect personalized responses

Separate shared, private and application caches, inspect keys, revalidation and invalidation after access-right changes.

· 2 min

Method diagram: Layers → Policy → Keys → Revalidation → Isolation Method diagram · steps explained in the text

What this guide helps achieve

  • Inventory layers
  • Choose retention
  • Inspect keys
  • Exercise revalidation and change

Quick check

  • Does no-cache mean nothing is retained?
  • Does Vary protect access rights?
  • Should every API be cached?

Step-by-step method

  1. 01

    Inventory layers

    List browser, CDN, proxy, service worker and application caches. Classify public and personalized responses. An HTTP policy does not automatically describe caching implemented in code.

    Deliverable: layers and owners diagram.

  2. 02

    Choose retention

    RFC 9111 distinguishes directives: no-cache requires validation before reuse, no-store prohibits the relevant HTTP storage, and unqualified private excludes shared storage. None alone guarantees system confidentiality.

    Deliverable: retention policy per response.

  3. 03

    Inspect keys

    Check method, URI and dimensions changing a representation. Vary concerns request fields; it is not authorisation. Seek omitted language, format negotiation and account context in application layers.

    Deliverable: keys and separation tests.

  4. 04

    Exercise revalidation and change

    Test fresh and stale responses, data updates and revoked rights. Inspect ETag, conditional validation and origin-unavailable behaviour. A formerly correct response may become sensitive after revocation.

    Deliverable: before-and-after traces.

  5. 05

    Replay with two accounts

    Use fictional identities and markers. Alternate requests to the same URI with warm and cold caches. Check logout, direct links and logging without recording real tokens.

    Deliverable: negative tests and invalidation strategy.

Reusable worksheet

Complete with your authorised observations. These fields are a working template, not observed results.

FieldInformation to record
ResponsePublic or personalized; dimensions
LayerCache, owner and key
PolicyRetention, freshness and validation
TrialFictional account, change and observation

Worked example

Illustrative situation

Fictional example: a CDN reuses a profile response at the same URI for two test accounts.

Decision and expected evidence

The scenario detects leakage, examines policy and keys, then replays after correction and access revocation.

Distinguish the mechanisms

MechanismPurposeCheck or limitation
no-cachePermit storage with required validationDo not read it as no storage
Unqualified privateExclude shared cachingDo not read it as a confidentiality guarantee
no-storePrevent the relevant HTTP storageCheck application caches and history separately

Management indicators

IndicatorWhat it measuresFirst action
Account separationNo marker from another accountInspect body, links and metadata
Age and validationReuse consistent with policyTest expiry and unavailable origin
Invalidation delayTime until corrected representationName each layer still stale

Common pitfalls

  • Do not read it as no storage
  • Do not read it as a confidentiality guarantee
  • Check application caches and history separately

Frequently asked questions

Does no-cache mean nothing is retained?

No. It requires validation before reuse; it does not prohibit storage as no-store does.

Does Vary protect access rights?

No. It participates in representation selection; authorisation remains separate.

Should every API be cached?

No. Benefits depend on cost, freshness and risk. Sensitive responses may justify avoiding shared caches.

Official references

References consulted on 2 October 2026. The method and worksheet propose checks to adapt to your context; they do not constitute certification.