I have one question: suppose in each http request there is a cache-control: max-age=0
header, so each request will go all the way to the origin web server.
Does it mean CDN is not useful anymore if all requests are like this?
By setting the max-age to 0, you effectively expire your page in your CDN edge cache immediately. Therefore, your CDN always hit your origin and render the CDN useless as you suggested.
Noticed from your other question that you are using Akamai. If so, then you can use the Edge-Control
header to override your cache-control
if you don't have direct control over that value, but still want to be able to leverage CDN functionality.
hi,Jason I got your suggestion.
Any chance that's a chrome or some other level of caching? If reached the CDN, it should have respected the maxage and thus not sent the 304, but I've seen even browsers or network appliances like an f5 or something also provide caching and thus the 304 without reaching the edge.
I tested some beahviors of browser 1: after cache expired in browser,I open a new windows to enter the link,browser sends "If-Modified-Since:" header to outside,and got an http 304 2:if browser cache is not expired ,I use "F5" to refresh,browser sends "If-Modified-Since:+Cache-Control:max-age=0" header to outside,and got an http 304.
my question is : the first request is served by akamai (akamai doesn't talk to origin server once cache in akamai is not expired since there is other request which refresh this content),but the 2nd request goes all the way to origin since there is max-age=0. and the 1st request is how akamai serve the client in most case,am I right?
I use chrome as the test browser