Auto refresh for expired content?

Roman Arutyunyan arut at
Wed May 17 11:12:56 UTC 2017


On Wed, May 17, 2017 at 03:29:03AM -0400, mkuehn wrote:
> Hi Francis,
> thanks a lot for your reply!
> I tried to use proxy_cache_background_update with the following config
> part.
> proxy_cache_path /var/cache/nginx/spieldaten levels=1:2
> keys_zone=spieldaten:100m max_size=150m inactive=5d use_temp_path=off;
> ... ... ...
>             proxy_cache test;
>             proxy_cache_valid 200 302 1m;
>             proxy_cache_valid 404 1m;
>             proxy_cache_valid any 2m;
>             proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
>             proxy_cache_use_stale error timeout updating http_500 http_502
> http_503 http_504;
>             proxy_cache_lock on;
>             proxy_cache_background_update on;
> So my hope was with an inactive setup of 5d, even the requests which are not
> often called, will be keep i the cache and proxy_cache_background_update
> will do the magic - if a user request content, it will be fetch the "old"
> one from the cache and nginx will fetch a fresh copy in the background.
> But unfortunately the user gets always the old one from the cache, if
> proxy_cache_background_update is on - so something must be wrong with my
> config?!?

Can you check if the update request comes to your backend when user gets the
old cached response?


Roman Arutyunyan

More information about the nginx mailing list