Spaces CDN TTL question

January 6, 2019 496 views
CDN

Just wondering - with the Spaces CDN, if you set a low TTL, does a client requesting an expired file (that hasn’t been modified):

1) Always download a new file from Origin > Edge > Client, or

2) The CDN Edge does a request to Origin, receives 304 Not Modified and returns the cached file from Edge > Client ?

??

1 Answer

Regardless of what TTL value you set if an object has expired from the CDN cache and you have CDN enabled when a request goes to the CDN and the object isn’t there, it is retrieved from the object store, cached, and then the cached object is returned to the source making the request.

The idea is that the cache is always kept fresh. So you want to limit the number of times that objects are being transferred so its:

Request -> CDN -> object expired -> Object Store -> Cached in CDN -> Returned

Have another answer? Share your knowledge.