On 03.10.2014 13:42, Grzegorz Kulewski wrote:
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.
HIT, STALE, UPDATING, REVALIDATED causes to read from a cache.
MISS, EXPIRED, BYPASS causes to write to a cache.
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?
Anything suspicious in error log?
If not, looking at debug log should be a good thing to do.
http://nginx.org/en/docs/debugging_log.html
Search for "http file cache update" in logs.
Also, make sure that you are not hitting cache format change in 1.7.3:
http://hg.nginx.org/nginx/rev/44b9ab7752e3
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx