]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: cache: forbid cache rules in defaults sections
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 12 Nov 2026 08:48:38 +0000 (09:48 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 12 Nov 2026 17:20:31 +0000 (18:20 +0100)
commit15a89ceed3ddeae597f25be7b38748f6a1d2774f
tree09d23acd3b67a8067b378a198c3c00ad61a787de
parenta72de10226b265202f5820b48b7a52c99382a1b6
BUG/MEDIUM: cache: forbid cache rules in defaults sections

A "cache-use" or "cache-store" rule declared in a defaults section has
never worked: the implicit cache-store filter it creates is attached to
the defaults section itself, where the "filter" directive is not
supported. The filter is never resolved, and the rule inherited by the
proxies references a configuration pointing at an unresolved cache name
instead of a cache, which leads to crashes or silently broken caching
depending on the filter mode of the proxies.

Supporting these rules with the legacy filters would require a deep
rework of the rule-to-filter binding, hard to backport. So, until the
new filter API covers this case, the rules are simply forbidden in a
defaults section, with an explicit alert:

    [ALERT] : Proxy 'd': 'cache-use' rules are not supported in a defaults section.

This patch must be backported to all supported versions.
reg-tests/cache/defaults_rules_forbidden.vtc [new file with mode: 0644]
src/cache.c