You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "incheoloh (via GitHub)" <gi...@apache.org> on 2024/11/12 09:04:42 UTC

[I] Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache [trafficserver]

incheoloh opened a new issue, #11854:
URL: https://github.com/apache/trafficserver/issues/11854

   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?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache [trafficserver]

Posted by "incheoloh (via GitHub)" <gi...@apache.org>.
incheoloh commented on issue #11854:
URL: https://github.com/apache/trafficserver/issues/11854#issuecomment-2481989363

   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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on issue #11854:
URL: https://github.com/apache/trafficserver/issues/11854#issuecomment-3543906635

   My recent PR addresses this issue:
   https://github.com/apache/trafficserver/pull/12665


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall closed issue #11854: Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache
URL: https://github.com/apache/trafficserver/issues/11854


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative Response Caching with Proxy.config.http.negative_caching_lifetime vs TTL-in-Cache [trafficserver]

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on issue #11854:
URL: https://github.com/apache/trafficserver/issues/11854#issuecomment-2515573596

   Unfortunately, it's unlikely anyone from the current development team have interest in adding features to caching.config. Rather, what people tend to do these days is using the header_rewrite plugin, with configurations such as
   
   ```
   cond %{READ_RESPONSE_HDR_HOOK} [AND]
   cond %{STATUS} >199 [AND]
   cond %{STATUS} <299
       set-header Cache-Control "max-age=20"
   ```
   
   with an optional rule as well (removing CC to clients)
   
   ```
   cond %{SEND_RESPONSE_HDR_HOOK} [AND]
   cond %{STATUS} >199 [AND]
   cond %{STATUS} <299
       rm-header Cache-Control
   ```
   
   (or even just always remove the CC header regardless). Using header_rewrite here, rather than the cache.config, has many benefits:
   
   1. It's much faster than evaluating one or many regular expressions. Although you can of course also do regexes here if you want, to only apply caching to some specific URLs.
   2. With header_rewrite (or Lua or Cripts) you have a lot more flexibility of making complex rules.
   3. Safer. You limit the rules to only ever apply to the remap line that it's configured for.
   
   Probably not the answer you wanted, and likely we ought to eliminate cache.config in some future version.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org