]> git.kaiwu.me - haproxy.git/commit
MEDIUM: cache: add support for hints-only HTTP caches
authorMaxime Henrion <mhenrion@haproxy.com>
Tue, 30 Jun 2026 15:33:37 +0000 (11:33 -0400)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Jul 2026 14:42:35 +0000 (16:42 +0200)
commit475a69d2241e863e5e66b4669a4b84097c8782b3
treec0b68936596d44790230aa29aedb820bbb9c5c1b
parent39233e0a673e5cd12dec4c2fe90efcdce038aa05
MEDIUM: cache: add support for hints-only HTTP caches

The "early-hints" option can now be set to "only", in which case the
cache will only store data relevant to the emission of 103 Early Hints
responses.

Hint records are extracted on the fly from the live response HTX
rather than going through a full-storage-then-strip cycle: the entry
is created as CACHE_EF_STRIPPED directly, with hint records written
past the cache_entry header at storage time. Response bodies are
never stored.

Because entries are stripped from the start, eviction in this mode
never has to strip a full entry; the full LRU stays empty and
cache_make_room() falls through to evicting the oldest stripped entry
when the cache fills up.

The max-object-size check (which gates caching based on the upstream-
announced Content-Length) is bypassed in this mode: the actual stored
entry is just the hint records (typically under 1 KB), so applying it
to the body size would needlessly discard hints for arbitrarily large
responses.

As a hints-only entry is never served as a response, the backend
response is forwarded unchanged in this mode: in particular its Age
header is kept rather than stripped as it is for a stored response.
doc/configuration.txt
reg-tests/cache/early_hints_only.vtc [new file with mode: 0644]
src/cache.c