From: Christopher Faulet Date: Wed, 21 Oct 2026 08:35:47 +0000 (+0000) Subject: BUG/MINOR: cache: do not refuse to store responses with "Age: 0" X-Git-Url: https://git.kaiwu.me/%7B@url%7D?a=commitdiff_plain;h=26b254c14b3c14f76bcfcd8984bfee6efcf08778;p=haproxy.git BUG/MINOR: cache: do not refuse to store responses with "Age: 0" Responses carrying an "Age: 0" header are never stored in the cache. This header is commonly emitted by an upstream cache or CDN delivering an object it just fetched, so in a setup chaining caches, the haproxy cache simply never stores these objects and all requests for them reach the servers, which only affects performance and the load of the servers. The Age value is parsed with strl2llrc() and only accepted when strictly positive, any other case jumping to the "out" label as an invalid value. Zero is a perfectly valid Age value (RFC 9111#5.1), it is not stale and needs no special treatment, so it is now accepted like positive values. Negative or non-numerical values are still considered invalid. This patch may be backported to all supported versions. --- diff --git a/src/cache.c b/src/cache.c index 834bb3720..9000eb98d 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1814,7 +1814,7 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px, ctx.blk = NULL; if (http_find_header(htx, ist("Age"), &ctx, 0)) { long long hdr_age; - if (!strl2llrc(ctx.value.ptr, ctx.value.len, &hdr_age) && hdr_age > 0) { + if (!strl2llrc(ctx.value.ptr, ctx.value.len, &hdr_age) && hdr_age >= 0) { if (unlikely(hdr_age > CACHE_ENTRY_MAX_AGE)) hdr_age = CACHE_ENTRY_MAX_AGE; /* A response with an Age value greater than its