Force cache refresh

Igor Sysoev igor at sysoev.ru
Thu Jun 17 22:33:19 MSD 2010


On Thu, Jun 17, 2010 at 06:24:44PM +0000, Ole Laursen wrote:

> I'd like to force a refresh of a cache entry - is there any built-in way of
> doing that? So the incoming request retrieves a new response from the back-end
> and inserts it in the cache even if the previous entry was still valid?
> 
> I have some pages that take > 1 s to generate. I'm caching those with
> proxy_cache with a timeout of a few minutes. Works fine, but unfortunately the
> first client that gets in after a slow period will have to wait. I'd like to be
> able to refresh some URLs periodically with a script, keeping the cache warm, so
> it's always snappy.

You may bypass cache using "Some-Secret-Header: 1" in a request and setting:
    proxy_no_cache  $http_some_secret_header;
The response may be cached.


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list