proxy_cache_bypass and cache refresh

Grzegorz Kulewski gk at leniwiec.biz
Fri Oct 10 15:13:45 UTC 2014


Anyone?

W dniu 03.10.2014 11:42, Grzegorz Kulewski pisze:
> Hello,
> 
> Is it true that a GET request that satisfies proxy_cache_bypass (and generates BYPASS cache status in the access log) should also refresh proxy cache for that URL?
> 
> There are several tutorials on the Internet that advise that it works. Also it was working for us before but stopped - either after nginx upgrade or after some configuration change - not sure right now. We are currently running nginx 1.4.7.
> 
> Parts of configuration:
> 
> http {
> proxy_cache_path /var/cache/www levels=1:2 keys_zone=foo-cache:256m max_size=4g inactive=1h;
> proxy_cache_key "$host$request_uri";
> proxy_cache_lock on;
> proxy_cache_lock_timeout 120s;
> proxy_no_cache $upstream_http_x_bar_dont_cache_me $cookie_x_no_cache;
> proxy_cache_bypass $http_x_bar_cache_refresh $cookie_x_bar_no_cache;
> }
> 
> location = / {
> proxy_pass http://foo_old_www;
> proxy_cache foo-cache;
> proxy_cache_valid 200 1h;
> }
> 
> 
> Request to refresh cache (I double checked that it generates a GET request and a cache status BYPASS):
> 
> curl -H 'X-Bar-Cache-Refresh: true' -D - 'http://www.foo.pl/'
> 
> 
> Any idea why it doesn't work?

-- 
Grzegorz Kulewski



More information about the nginx mailing list