It is said that the web servers' clocks must be identical for the Expires
and Cache-Control
headers to work? Why is that? Can't they be off by 1 second or a few minutes?
If the cache is supposed to be good for 1 year, then won't a time difference of a few minutes or even a few hours not matter on one or some of the web servers?
In the documentation it is said that:
note that in order for this [caching] to work, all your application servers must return the same timestamps. This means that they must have their clocks synchronized. If one of them drifts out of sync, you‘ll see different timestamps at random and the cache won‘t work. In that case the browser will request the same assets over and over again even thought they didn‘t change. You can use something like Live HTTP Headers for Firefox to verify that the cache is indeed working.
If you run ntpd on all your hosts (and you do, don't you?) they'll be more than close enough. It has less to do with the headers than with the caching controllers generating the ?1232285206
at the end of the URLs. That's just a Unix epoch time (seconds since 00:00:00 Jan 1 1970), so being within a few seconds should do just fine for content that is okay to cache. ntpd typically keeps a quarter-second or less tolerance. (In a series of ntpdate
tests against multiple time servers, my computer was never more than .15 seconds off.)