]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: http-ana: do not store responses to requests with "no-store" master
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 21 Oct 2026 09:05:01 +0000 (09:05 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 27 Nov 2026 15:50:22 +0000 (16:50 +0100)
commitc2852d5b7c27fb93abc1cfb3246e6e172481ca17
tree8d43e05e9684aba65a04f5eff88edbf76a1e5245
parent433c7916358bdcec81f8936b0c244aaf73af410f
BUG/MINOR: http-ana: do not store responses to requests with "no-store"

A request carrying "Cache-Control: no-store" normally prevents its
response from being stored in the cache. But when the response carries
"Cache-Control: public", it is stored anyway and delivered to other
clients, while RFC 9111#5.2.1.5 says that a cache must not store any part
of the request or of its response, whatever the response says. A client
asking for its response not to be stored, for privacy reasons, may thus
see it delivered to others, though the server marked it as public.

http_check_request_for_cacheability() handles "no-store" by clearing
TX_CACHEABLE and TX_CACHE_COOK, but http_check_response_for_cacheability()
sets them again on "public", since this directive may legitimately make
cacheable a response which is not by default.

The request's directive is now remembered in the TX_CACHE_NOSTORE flag
added by the previous patch, and the response is never considered
cacheable when it is set, whatever its own directives.

The reg-test reg-tests/cache/request_nostore.vtc sends a request with
"no-store" receiving a public response, and checks that it was not
stored. It fails without the fix.

The request's "no-store" was handled since commit 0ad8e0dfe ("MINOR: http:
add a function to check request's cache-control header field") in 1.8,
and the response's "public" could always override it. The fix may be
backported to all supported versions, along with the previous commit
("MINOR: http-ana: add a transaction flag for requests forbidding
storage").
reg-tests/cache/request_nostore.vtc [new file with mode: 0644]
src/http_ana.c