challenge / use case
A response stating no explicit expiration is revalidated on every exchange, even where it carries a Last-Modified
field that says how volatile the content actually is. An origin whose content has not changed in a year is re-fetched
as eagerly as one edited a minute ago.
proposal
Derive a freshness lifetime from the response header fields where the origin states no explicit expiration, as
permitted by RFC 9111 § 4.2.2: take the interval since Last-Modified and treat a fraction of it as the lifetime,
around 10% as the RFC encourages.
Guards:
- apply only where no
Cache-Control freshness directive and no Expires is stated; no-cache and max-age=0 are
stated expirations and must keep winning, so the test is whether a directive is present, not whether the computed
lifetime is 0
- apply only for the heuristically cacheable status codes of RFC 9110 § 15.1
- bound the result, so a distant
Last-Modified does not yield an unbounded lifetime
- let
ttl cap the result as it caps any computed lifetime
alternatives
Leaving it to the consumer to state a flat lifetime. That covers an origin stating nothing at all, but ignores the
volatility an origin does state, so a stable and a churning resource are reused for the same span.
notes
Ranks between the two cases already settled: a stated expiration wins over this, and this wins over a flat lifetime
the consumer states for an origin whose responses carry no Last-Modified either.
challenge / use case
A response stating no explicit expiration is revalidated on every exchange, even where it carries a
Last-Modifiedfield that says how volatile the content actually is. An origin whose content has not changed in a year is re-fetched
as eagerly as one edited a minute ago.
proposal
Derive a freshness lifetime from the response header fields where the origin states no explicit expiration, as
permitted by RFC 9111 § 4.2.2: take the interval since
Last-Modifiedand treat a fraction of it as the lifetime,around 10% as the RFC encourages.
Guards:
Cache-Controlfreshness directive and noExpiresis stated;no-cacheandmax-age=0arestated expirations and must keep winning, so the test is whether a directive is present, not whether the computed
lifetime is
0Last-Modifieddoes not yield an unbounded lifetimettlcap the result as it caps any computed lifetimealternatives
Leaving it to the consumer to state a flat lifetime. That covers an origin stating nothing at all, but ignores the
volatility an origin does state, so a stable and a churning resource are reused for the same span.
notes
Ranks between the two cases already settled: a stated expiration wins over this, and this wins over a flat lifetime
the consumer states for an origin whose responses carry no
Last-Modifiedeither.