Skip to content

RFC 9211: optional Cache-Status response header - #867

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:cache-status-rfc9211
Aug 18, 2026
Merged

RFC 9211: optional Cache-Status response header#867
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:cache-status-rfc9211

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Adds optional support for the RFC 9211 Cache-Status response header to the caching executors.

When enabled, the cache records how each response was produced — a cache hit,cor a forward to the origin with the reason (bypass, method, uri-miss, vary-miss, request, stale) and the upstream status code where relevant — and emits a
Cache-Status header identified as Apache-HttpClient.

Disabled by default; enabled with CacheConfig.setCacheStatusEnabled(true).
Applies to both the classic and async cache execution paths.

@arturobernalg
arturobernalg requested a review from ok2c August 18, 2026 05:57
@arturobernalg
arturobernalg requested a review from ok2c August 18, 2026 15:19
Adds optional support for the RFC 9211 Cache-Status response header. When enabled through
CacheConfig the caching executors record how each exchange was handled in a per-exchange CacheStatus,
and CacheStatusHeaderGenerator serialises it into the Cache-Status header.

CacheStatus is the single source of truth for the disposition of an exchange. The coarse
CacheResponseStatus exposed on HttpCacheContext is now derived from it on the fly instead of being
stored as a separate attribute, so the two can no longer drift apart. A locally generated response
and a stale response served by the module under stale-while-revalidate or stale-if-error map to a
module response, an internal error that falls back to the origin maps to a failure, a successful
revalidation of a stored entry maps to validated, a response served from a stored entry to a hit,
and any other forwarded response to a miss.
@arturobernalg
arturobernalg merged commit 83386f2 into apache:master Aug 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants