Clarification on stale-while-revalidate / stale-if-error

In RFC 5861, stale-while-revalidate has MAY priority
https://tools.ietf.org/html/rfc5861#section-3

When present in an HTTP response, the stale-while-revalidate
Cache-Control extension indicates that caches MAY serve the response
in which it appears after it becomes stale, up to the indicated number
of seconds.


Meanwhile, in RFC 7234,


   A cache MUST write through requests with methods that are unsafe
   (Section 4.2.1 of [RFC7231]
<https://tools.ietf.org/html/rfc7231#section-4.2.1>) to the origin
server; i.e., a cache is
   not allowed to generate a reply to such a request before having
   forwarded the request and having received a corresponding response.


So this means that stale-while-revalidate have no effect on unsafe methods
-- you can specify it on POST, but you'll have to wait for successful
revalidation.

However, stale-if-error doesn't have this problem -- it's just a 500, even
on an unsafe method.  So you ARE allowed to return stale in that case.
This would be interest in services which return a Location: header on
success, but could return errors because they don't deal with idempotency
well.

Does this sound right?

Received on Wednesday, 6 May 2015 18:13:18 UTC