Open gmetais opened 8 years ago
Point 1: makes sense.
As for the second point: I'd rather not consider Age
response header. phantomas reports the caching policies from the "server perspective". Including Age
in the equation would make these metrics not quite deterministic (i.e. depending on the time we hit the caching layer).
Point 3: definitely worth reporting (and yay for Internet Explorer "awesome" features :) )
Thanks, @gmetais! Have a nice weekend :)
Hi,
I've been auditing nasty cache problems recently, and I've learnt some vicious things about caching headers:
1) If a
Date
header is provided by the server, the browser uses it to calculate the expire date. TheDate
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 ofnew Date()
when it's available.2) If the server provides an
Age
header, the browser also uses it to calculate the expiration date :TTL = max-age - age
.3) If there is a
Vary
header and its is notAccept-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.