question about proxy_cache_valid

s0cke at s0cke at
Fri Sep 11 17:13:21 MSD 2009

Maxim Dounin wrote:

>> So when I use "proxy_cache_use_stale off;" which is default, nginx will  
>> request the file again from the backend, if the time in  
>> "proxy_cache_valid" is over?
> Yes.

This did not work for me at all.

  >>>> For some reason my cache still contains a file, that has been 
>>>> on  my backend 10 hours ago. Both, proxy_cache_valid and inactive= 
>>>> are set  to 2h. Maybe the two settings have different meanings and I 
>>>> do not  understand yet.
>>> Which version?  From the description it looks like a bug fixed in  
>>> 0.8.14:
>>>     *) Bugfix: an expired cached response might stick in the "UPDATING" 
>>>        state.
>>> If you see this in 0.8.14 - please provide more details.
>> I am using the stable version (0.7.61). Do I have to update to 0.8.14 in  
>> order to get this working? I'm not sure whether it's my config or a bug.
> Stable doesn't have this fix yet, so you either have to upgrade or 
> wait for fix to be merged.  No idea when merge will happen though.

So I updated to 0.8.14, but still the files were in the nginx cache for 
hours even though I deleted them on the backend.
Then I stumbled on this topic:,2182
After adding "proxy_ignore_headers Expires Cache-Control;" to my config, 
the cache started working as expected.
Especially this part is interesting:

This just means that upstream's caching instructions are more important 
than proxy_cache_valid, right?

Yes, the order is

I think this should be added to the wiki to "proxy_cache_valid".
There already is a small hint to that behavior in the wiki at 
"proxy_cache" but I think this is not enough (at least it wasn't for me).

Well, now it works perfectly and I'm happy :)

More information about the nginx mailing list