[nginx] Cache: support for stale-while-revalidate and stale-if-error.

Chris Branch cbranch at cloudflare.com
Mon Feb 13 17:07:15 UTC 2017

I noticed there was no test suite for this new feature. I’m not expecting my patch to be approved as time-based tests slow down test suites - but I think it warrants some testing.

I have a conflicting requirement that isn’t easily supported by nginx currently; I want to enable ‘proxy_cache_use_stale updating’ for responses that do not include stale-while-revalidate. Unfortunately using this directive breaks the stale-while-revalidate functionality. See the tests patch for an example. Removing the 'proxy_cache_use_stale updating’ directive makes the tests pass as expected.

Should ‘updating’ support both cases, or should a new directive be added to handle this case? AIUI, stale-while-revalidate is an explicit instruction from upstream not to serve the content after the stale period expires. Without that directive, we are allowed to serve stale for an indefinite amount of time (subject to exceptions in an HTTP request per RFC 2616…).

> On 10 Feb 2017, at 17:30, nginx-devel-request at nginx.org wrote:
> [nginx] Cache: support for stale-while-revalidate and
> 	stale-if-error.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170213/2d023bb7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170213/2d023bb7/attachment-0001.bin>

More information about the nginx-devel mailing list