]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: cache: Cache response even if request has "no-cache" directive
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Tue, 21 Feb 2023 10:47:17 +0000 (11:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Feb 2023 17:35:41 +0000 (18:35 +0100)
commit879debeecb93202c983f25f5f1d765e74d77faa5
tree243dcd61f5084936339fa1c34fbc28838d3e26fb
parentd4c0be6b20f5365dc00221b51face2a32cf4053b
BUG/MINOR: cache: Cache response even if request has "no-cache" directive

Since commit cc9bf2e5f "MEDIUM: cache: Change caching conditions"
responses that do not have an explicit expiration time are not cached
anymore. But this mechanism wrongly used the TX_CACHE_IGNORE flag
instead of the TX_CACHEABLE one. The effect this had is that a cacheable
response that corresponded to a request having a "Cache-Control:
no-cache" for instance would not be cached.
Contrary to what was said in the other commit message, the "checkcache"
option should not be impacted by the use of the TX_CACHEABLE flag
instead of the TX_CACHE_IGNORE one. The response is indeed considered as
not cacheable if it has no expiration time, regardless of the presence
of a cookie in the response.

This should fix GitHub issue #2048.
This patch can be backported up to branch 2.4.
include/haproxy/http_ana-t.h
reg-tests/cache/caching_rules.vtc
src/cache.c
src/http_ana.c