@@ -234,6 +234,84 @@ Traffic Server applies ``Cache-Control`` servability criteria after HTTP
234234freshness criteria. For example, an object might be considered fresh but will
235235not be served if its age is greater than its ``max-age ``.
236236
237+ Targeted Cache Control (RFC 9213)
238+ ----------------------------------
239+
240+ Traffic Server supports `RFC 9213 <https://httpwg.org/specs/rfc9213.html >`_
241+ Targeted HTTP Cache Control, which allows origin servers to provide different
242+ cache directives for different classes of caches. This is particularly useful in CDN deployments where you want to
243+ give different caching instructions to CDN caches versus browser caches.
244+
245+ For example, an origin server might send::
246+
247+ Cache-Control: max-age=60
248+ CDN-Cache-Control: max-age=3600
249+
250+ When targeted cache control is enabled (via
251+ :ts:cv: `proxy.config.http.cache.targeted_cache_control_headers `), Traffic
252+ Server will use the ``CDN-Cache-Control `` directives instead of the standard
253+ ``Cache-Control `` directives for caching decisions. The browser receiving the
254+ response will see both headers and use the standard ``Cache-Control ``, allowing
255+ the object to be cached for 60 seconds in the browser but 3600 seconds in the CDN.
256+
257+ Configuration
258+ ~~~~~~~~~~~~~
259+
260+ To enable targeted cache control, set
261+ :ts:cv: `proxy.config.http.cache.targeted_cache_control_headers ` to a
262+ comma-separated list of header names to check in priority order::
263+
264+ # In records.yaml:
265+ proxy.config.http.cache.targeted_cache_control_headers: CDN-Cache-Control
266+
267+ Or with multiple targeted headers in priority order::
268+
269+ proxy.config.http.cache.targeted_cache_control_headers: ATS-Cache-Control,CDN-Cache-Control
270+
271+ This configuration is overridable per-remap, allowing different rules for
272+ different origins::
273+
274+ # In remap.config:
275+ map / https://origin.example.com/ @plugin=conf_remap.so \
276+ @pparam=proxy.config.http.cache.targeted_cache_control_headers=CDN-Cache-Control
277+
278+ Behavior
279+ ~~~~~~~~
280+
281+ - When a targeted header is found (first match in the priority list), its
282+ directives replace the standard ``Cache-Control `` directives for all caching
283+ decisions.
284+
285+ - If no targeted headers are present or they are all empty, Traffic Server falls
286+ back to the standard ``Cache-Control `` header.
287+
288+ - Targeted headers are passed through to downstream caches, allowing CDN chains
289+ to use the same directives.
290+
291+ - All standard cache control directives are supported in targeted headers:
292+ ``max-age ``, ``s-maxage ``, ``no-cache ``, ``no-store ``, ``private ``,
293+ ``must-revalidate ``, etc.
294+
295+ Use Cases
296+ ~~~~~~~~~
297+
298+ **CDN with origin cache **: An origin might have its own caching layer but want
299+ CDNs to cache more aggressively::
300+
301+ Cache-Control: max-age=60
302+ CDN-Cache-Control: max-age=86400
303+
304+ **Different CDN policies **: Using multiple CDN providers with different needs::
305+
306+ Cache-Control: max-age=300
307+ CDN1-Cache-Control: max-age=3600
308+ CDN2-Cache-Control: max-age=1800
309+
310+ **Prevent CDN caching while allowing browser caching **::
311+
312+ Cache-Control: max-age=300
313+ CDN-Cache-Control: no-store
314+
237315Revalidating HTTP Objects
238316-------------------------
239317
0 commit comments