Skip to content

Conversation

@bneradt
Copy link
Contributor

@bneradt bneradt commented Nov 15, 2025

When both negative_caching_lifetime and cache.config ttl-in-cache are configured, ttl-in-cache was incorrectly taking precedence for negative responses (404, 403, 500, etc.). This caused negative responses to be cached for the ttl-in-cache duration instead of the intended shorter negative_caching_lifetime. The fix modifies what_is_document_freshness() to skip the ttl-in-cache check for negatively cached responses, allowing them to use the Expires header set by negative_caching_lifetime instead.


For Review

Configuring github to ignore whitespace is helpful in viewing this patch.

@bneradt bneradt added this to the 10.2.0 milestone Nov 15, 2025
@bneradt bneradt added the Cache label Nov 15, 2025
@bneradt bneradt self-assigned this Nov 15, 2025
When both negative_caching_lifetime and cache.config ttl-in-cache are
configured, ttl-in-cache was incorrectly overriding
negative_caching_lifetime for negative responses (404, 403, 500, etc.).
This caused negative responses to be cached for the ttl-in-cache
duration instead of the intended negative_caching_lifetime. The
fix modifies what_is_document_freshness() to skip the ttl-in-cache check
for negatively cached responses.
Copy link
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@bneradt bneradt merged commit 129a638 into apache:master Nov 20, 2025
15 checks passed
@bneradt bneradt deleted the fix_negative_caching branch November 20, 2025 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache

3 participants