Skip to catalogue

198

HTTP caching

Cache-Control tells the browser and the CDN what they may reuse. A missing header is not “no cache.” It is “guess.”

What is HTTP caching?

HTTP caching uses headers: `Cache-Control`, `ETag`, `Vary`. `max-age` is freshness. `no-store` means do not keep it. `ETag` lets the client revalidate. `Vary` says which request headers change the body. Without `Vary: Authorization` or a cookie, a shared cache can store a private response under a public key.

Why does HTTP caching matter when vibe coding?

Models set no headers, or `no-cache` on fingerprinted files that could live for a year. Name public versus private.

How do you do HTTP caching?

Fingerprinted static files: long `max-age`, immutable. HTML: revalidate. APIs with auth: `private, no-store` unless you have designed a shared cache key. Set `Vary` if the body depends on a header.

How do you ask a model for HTTP caching?

Set Cache-Control on (response). Public fingerprinted assets can be immutable. Personalized responses are private, no-store. If the body depends on a header, set Vary. Do not leave caching to the default.

What goes wrong with HTTP caching?

`no-cache` does not mean “do not cache.” It means revalidate. Use `no-store` when you mean do not keep a copy.

adjacent