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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]