Will Nginx serve stale cache after expiry if was unable to refresh the cache?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Will Nginx serve stale cache after expiry if was unable to refresh the cache?

Quintin Par

Relevant code:

proxy_cache_valid   200 301 302 1d;

proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;

proxy_cache_background_update on;

proxy_cache_lock on;

 

 

The URL in question is obviously cached for 1 day. 15 minutes after the day is over, the proxy gets a request and tries to refresh the content but is met with an error (500) from the backend. In this case, will it continue to serve stale until it gets a proper new 200 content? 


- Quintin

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Will Nginx serve stale cache after expiry if was unable to refresh the cache?

Maxim Dounin
Hello!

On Tue, Oct 02, 2018 at 08:34:25AM +0530, Quintin Par wrote:

> Relevant code:
>
> proxy_cache_valid   200 301 302 1d;
>
> proxy_cache_use_stale  error timeout invalid_header updating http_500
> http_502 http_503 http_504;
>
> proxy_cache_background_update on;
>
> proxy_cache_lock on;
>
> The URL in question is obviously cached for 1 day. 15 minutes after the day
> is over, the proxy gets a request and tries to refresh the content but is
> met with an error (500) from the backend. In this case, will it continue to
> serve stale until it gets a proper new 200 content?

Yes, as per "proxy_cache_use_stale updating;", nginx will serve
stale cached response until it will be able to update the cache.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx