apache / trafficcontrol

Apache Traffic Control is an Open Source implementation of a Content Delivery Network
https://trafficcontrol.apache.org/
Apache License 2.0
1.08k stars 344 forks source link

Add TM cache-control headers #5130

Open jhg03a opened 4 years ago

jhg03a commented 4 years ago

I'm submitting a ...

Traffic Control components affected ...

Current behavior:

There are no cache control headers included with TM responses.

New behavior:

Please add either Cache-Control: no-cache or Cache-Control: max-age=1 to all TM responses. It's not generally appropriate for TM content to be cached, but a very short cache may be acceptable for extreme scalability issues.

Minimal reproduction of the problem with instructions:

Anything else:

rawlinp commented 2 years ago

Revisiting this issue, IIRC it was created due to an issue that would've been resolved sooner if TM had cache-control headers to prevent caching or cache for a very short period of time. However, I think the issue was mainly just index.html, because edges were making requests to TM as if it were supposed to be a forward proxy (oops).

The problem is, there are some TM APIs that definitely can/should be cached, so we don't want to prevent caching across everything. But I'm also a little hesitant to add cache-control headers to most of TM's APIs, since that could be surprising behavior and potentially require changing caching proxy configs that are already in place to cache TM API responses.

So, I'm inclined to focus mainly on index.html, since that was what the main issue was anyways, and I think we would be safe to add Cache-Control: max-age=2 to that page.