I have the same PHP code on two different websites on two different pages. The code simply displays the current time, and sets a http caching header using max-age to 60 seconds. I have a CDN server. When I run the pages, I see that the CDN is caching content from Server 1, but not Server 2. I looked at the header entries in web-sniffer.net and both of them are showing max-age as 60.
Are http headers dependent on the server. Since both of the websites are hosted on shared servers, but on different providers, do I have to look at anything else other than the code and .htaccess??
Why is CDN caching only content from just one server. Why is it not respecting the max-age entry from the other server?
When I try to actually view the header entries in the same page itself, I see HTTP_CACHE_CONTROL = max-age=0. Then, why is web-sniffer.net and curl showing max-age as 60. And which of them is correct.
Code that I have on the page:
header('Cache-Control: max-age=60, public');
echo date("F j, Y - H:i:s");
echo "<hr />";
foreach($_SERVER as $h=>$v)
if(ereg('HTTP_(.+)',$h,$hp))
echo "<li>$h = $v</li>\n";
?>
PS: I asked a similar question on Stackoverflow, but didn't get any helpful answers. So, I thought of posting it here. The question at Stackoverflow is at: https://stackoverflow.com/questions/8022529/max-age-doesnt-work