Skip to content

Enhance caching detection #645

@gmetais

Description

@gmetais

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. 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.

  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 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions