<div dir="ltr">Hello,<div><br></div><div>I am investigating the complexity of allowing for an additional parameter, "expired", to proxy_cache_use_stale. </div><div><br></div><div>Instead of a request hitting the backend with an $upstream_cache_status of EXPIRED and making the client wait for the request to complete, the client would instead be given a stale version of that cached entry, and that entry would be updated in the background.</div>
<div><br></div><div>The directive would look like:</div><div>proxy_cache_use_stale expired updating error ...;<br></div><div><br></div><div>I was looking into ngx_http_subrequest() as a potential route to take, but it looks like it's blocking (as in the client would have to wait for it to complete). I also looked at post_action, but it's unclear on whether it's blocking or not, and whether it'd work for this case.</div>
<div><br></div><div>Could you advise me on the best route to take here?</div><div><br></div><div>Varnish 4 supports this feature ("grace mode") and I'm getting some pressure to switch solely because of this feature, but because I love nginx so much, I figured I'd take a stab at getting this feature in.</div>
<div><br></div><div>Any tips would be well-appreciated.</div><div><br></div><div>Thanks!</div><div>-Ameir</div></div>