[PATCH 1 of 2] Cache: don't update cache if revalidated response is not cacheable

Piotr Sikora piotr at cloudflare.com
Tue Dec 23 01:02:32 UTC 2014

Hey Maxim,

> As you can see, RFC7232 doesn't really say they are different -
> instead, it requires servers to always add relevant headers.  On
> the other hand, if you'll look at the RFC7234 4.3.4 as linked from the
> paragraph you quoted, you'll find that after merging headers these
> two cases are still equivalent.

Agreed. On the other hand, it requires 304 responses to include all
cache-related headers.

> But even if you assume they are not equivalent (that is, (b) final
> response shouldn't have "Cache-Control: max-age=100") in case of (b)
> validity should be extended as if there are no Cache-Control
> headers in the response, i.e., per proxy_cache_valid.  This is not what
> happens with your patch, so the problem is here anyway.

Ironically, with the patch I sent, the cache will be updated according
to headers from cached response if there is nothing in 304 response
that sets the validity, which makes (a) and (b) equivalent... And as
far as I can tell, this matches the current behavior, so I'm not
really sure what's the problem you're talking about.

Best regards,
Piotr Sikora

More information about the nginx-devel mailing list