5 ms·
> Please note that you _explicitly_ declared the content as cacheable. You also declared that it instantly becomes stale, so the browser must revalidate the en
by masklinn 14y ago
> Please note that you _explicitly_ declared the content as cacheable.
You also declared that it instantly becomes stale, so the browser must revalidate the entry before returning it. Safari returning a resource with Cache-Control: max-age=0 without contacting the server beforehand is an incorrect behavior, goes against the spec and is not defensible.
> But one cannot complain about the fact that a browser cached a response that has explicitly been said by its producer to be cacheable.
Yes one can, and the problem is not that it was cached but that it was returned. A stale cached response returned without validation is an incorrect behavior unless the response also included staleness specifications (which I can't remember ever seeing in the wild). Revalidating is not optional: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.1.1 http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13... http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.3 http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13...
- gioele 14y agoRevalidating is optional. A browser MAY not revalidate if it likes so, unless you use `must-revalidate`: https://tools.ietf.org/html/rfc2616#section-14.9.3 https://tools.ietf.org/html/rfc2616#section-14.9.3 > A cache MAY be configured to return stale responses without validation, but only if this does not conflict with any "MUST"-level requirements concerning cache validation (e.g., a "must-revalidate" cache-control directive). https://tools.ietf.org/html/rfc2616#section-14.9.4 https://tools.ietf.org/html/rfc2616#section-14.9.4 > must-revalidate > Because a cache MAY be configured to ignore a server's specified expiration time, and because a client request MAY include a max-stale directive (which has a similar effect), the protocol also includes a mechanism for the origin server to require revalidation of a cache entry on any subsequent use.