Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
incheoloh opened this issue Nov 12, 2024 · 1 comment
Labels

Comments

@incheoloh
Copy link

cache.config

url_regex=.*    ttl-in-cache=20s

records.yaml

records:
  http:
    negative_caching_enabled: 1
    negative_caching_lifetime: 5

ttl-in-cache in cache.config sets a default TTL, applying this duration to cached responses regardless of the response code.
proxy.config.http.negative_caching_lifetime in records.yaml is intended to set the TTL for negative responses (e.g., 403, 404). However, if ttl-in-cache is defined in cache.config, it takes precedence and applies a TTL of 20 seconds to all responses, including 403.

Is there any way to use the value set by proxy.config.http.negative_caching_lifetime instead of the ttl set by ttl-in-cache for negative responses?

@incheoloh
Copy link
Author

The following configuration works as I wanted it to.
It would be better if there was a secondary specification called 'status' in the cache.config file.
(e.g dest_domain=example.com status=403 ttl-in-cache=60s)

If the default TTL is set to 1 day and negative response is set to 60 seconds
Cache-Control and Cache.config are not configured.

records.yaml

proxy.config.http.cache.heuristic_min_lifetime : 86400 
proxy.config.http.cache.heuristic_max_lifetime : 86400

proxy.config.http.negative_caching_enabled : 1
proxy.config.http.negative_caching_lifetime : 60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants