http-cache-semantics icon indicating copy to clipboard operation
http-cache-semantics copied to clipboard

RFC 7234 in JavaScript. Parses HTTP headers to correctly compute cacheability of responses, even in complex cases

Results 14 http-cache-semantics issues
Sort by recently updated
recently updated
newest added

The cache control RFC states in [section 5.2.2.2](https://httpwg.org/specs/rfc7234.html#rfc.section.5.2.2.2): > If the no-cache response directive specifies one or more field-names, then a cache MAY use the response to satisfy a subsequent...

Not always of course, but in some cases `timeToLive()` returns floats. Which makes sense since in `maxAge()` there's a division by 1000 and then later a multiplication by 1000 done...

I see there is an array `statusCodeCacheableByDefault` in code but is it possible to specify our own list?

Hi @kornelski, thanks for your work on this library, it looks fantastic. For my use case, I would need the library to support these two `Cache-Control` directives. From [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control): -...

Currently 301 redirects are not cached at all unless the website returns a satisfying `cache-control` header. This is not how browsers work. https://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s There should be a setting to cache...

```bash curl -v https://www.reservaentradas.com/cines < HTTP/1.1 200 OK < Date: Wed, 05 Feb 2020 18:51:26 GMT < Server: Apache/2.2.22 (Debian) < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control:...

The readme says that "`immutableMinTimeToLive` is a number of milliseconds", but it's compared against values which are in seconds (e.g. `Math.max(defaultMinTtl, (expires - dateValue) / 1000)`) and returned from `maxAge`...

> A cache MUST invalidate the effective Request URI (Section 5.5 of [RFC7230]) as well as the URI(s) in the Location and Content-Location response header fields (if present) when a...

HTTP libraries unzip the content, so the body in JS isn't strictly the same as body HTTP RFC is talking about.

Currently, there was an issue with the stale-while-revalidate options. The `satisfiesWithoutRevalidation` method didn't allow stale response to be returned when swr was set. I changed the logic so that the...