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.
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