Welcome! Log In Create A New Profile


Ignoring proxy_cache_background_update on;

Ian Stephens
March 01, 2019 07:26AM
We are running NGINX in front of our backend server.

We are attempting to enable the proxy_cache_background_update feature to
allow NGINX to async updates to the cache and serve STALE content while it
does this.

However, we are noticing that it still delivers STALE content slowly as if
it's not serving from the cache. The time it takes after an item expires is
very slow and clearly not served from cache - you can tell it's going to
the backend server, getting an update and delivering it to the client.

Here is our configuration from NGINX:

proxy_cache_revalidate on;

proxy_ignore_headers Expires;

proxy_cache_background_update on;

Our backend server is delivering the following headers:

HTTP/1.1 200 OK

Date: Thu, 28 Feb 2019 21:07:09 GMT

Server: Apache

Cache-Control: max-age=1800, stale-while-revalidate=604800

Content-Type: text/html; charset=UTF-8

When attempting an expired page fetch we do notice the following header:

X-Cache: STALE

However, when providing this response it is very slow as if it's contacted
the backend server and done it in realtime.

NGINX version:

$ nginx -v

nginx version: nginx/1.15.9

Any suggestions, tips and config changes are greatly appreciated.


It seems that the nginx server is honoring serving stale content (as we
have tested) but it also updates the cache from the backend on the same
request/thread thus causing the slow response time to the client. I.e. it
seems to be totally ignoring the proxy_cache_background_update on; directive
and not updating in the background on a separate subrequest (async).
nginx mailing list
Subject Author Posted

Ignoring proxy_cache_background_update on;

Ian Stephens March 01, 2019 07:26AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 62
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready