Hi,
I've been auditing nasty cache problems recently, and I've learnt some vicious things about caching headers:
-
If a Date header is provided by the server, the browser uses it to calculate the expire date. The Date header should always respond with the hour of the request, but some badly configured proxies don't reset it and keep the date when they last refreshed their cache.
So inside Phantomas, the TTL should be calculated using this header instead of new Date() when it's available.
-
If the server provides an Age header, the browser also uses it to calculate the expiration date : TTL = max-age - age.
-
If there is a Vary header and its is not Accept-Encoding, Host, User-Agent or any combination of these 3, than Internet Explorer will ignore the cache duration. Have a look here. See the update note at the end of the article? I've tested IE10 and IE11 and they have the same behavior as IE9.
The third point probably fits into the cachingDisabled metric, rather than creating a new metric.
Hi,
I've been auditing nasty cache problems recently, and I've learnt some vicious things about caching headers:
If a
Dateheader is provided by the server, the browser uses it to calculate the expire date. TheDateheader should always respond with the hour of the request, but some badly configured proxies don't reset it and keep the date when they last refreshed their cache.So inside Phantomas, the TTL should be calculated using this header instead of
new Date()when it's available.If the server provides an
Ageheader, the browser also uses it to calculate the expiration date :TTL = max-age - age.If there is a
Varyheader and its is notAccept-Encoding,Host,User-Agentor any combination of these 3, than Internet Explorer will ignore the cache duration. Have a look here. See the update note at the end of the article? I've tested IE10 and IE11 and they have the same behavior as IE9.The third point probably fits into the
cachingDisabledmetric, rather than creating a new metric.