trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Implement RFC 9213 Targeted HTTP Cache Control

Open bneradt opened this issue 1 month ago • 2 comments

This adds support for targeted Cache-Control headers (like CDN-Cache-Control) that allow cache directives to be targeted at specific caches. The implementation includes a configurable, priority-ordered list of targeted headers via proxy.config.http.cache.targeted_cache_control_headers, which is overridable per-remap rule. When a targeted header is present, it takes precedence over the standard Cache-Control header for caching decisions. Targeted headers are passed through downstream to allow proper cache hierarchy behavior.

Fixes: #9113

bneradt avatar Nov 20 '25 19:11 bneradt

@bneradt if you wanted to - you could run this patchset/branch against the tests in cache-tests https://cache-tests.fyi/#cdn-cache-control and see how many ATS is now passing for ☺️

JakeChampion avatar Dec 10 '25 14:12 JakeChampion

I know we suck in the area of overridable string configurations. But if I understand this, it will essentially “parse” this config string on every request, to find the headers that may contain the CC value(s) for this request ?

I know it’s hard, but could we pre-parse this (on load and reload) such that we build WKS for the common headers at least? And for the rest, have an array of TextView’s into the “raw” config string ?

These are good observations. I think I addressed these both - but let me know if I misunderstood something. I added CDN-Cache-Control to the WKS list and configured custom parsing to the possible targeted header list so that the parse is done once and cached from there as a string_view list.

bneradt avatar Dec 11 '25 04:12 bneradt