Force cache refresh
olau at iola.dk
Mon Jun 21 14:43:38 MSD 2010
Igor Sysoev <igor at ...> writes:
> A response to a bypassed request is cached only if you set
> some headers by backend:
> X-Accel-Expires: 30
> Cache-Control: max-age=30
> Expires with +30s time.
I can't get that to work either. :( I've tried setting all of these, no cigar.
Here's a log file dump
[21/Jun/2010:12:31:37 +0200] "GET /about/ HTTP/1.1" 200 5578 0.055 cache
status=- upstream_http_x_accel_expires=140 http_x_refresh_cache=1
[21/Jun/2010:12:31:50 +0200] "GET /about/ HTTP/1.1" 200 5586 0.032 cache
status=EXPIRED upstream_http_x_accel_expires=- http_x_refresh_cache=-
[21/Jun/2010:12:32:08 +0200] "GET /about/ HTTP/1.1" 200 5586 - cache
status=HIT upstream_http_x_accel_expires=- http_x_refresh_cache=-
with the log format defined as
log_format upstream '[$time_local] '
'"$request" $status $body_bytes_sent '
'cache status=$upstream_cache_status '
As you can see, the first entry satisfies the proxy_no_cache directive and
returns a X-Accel-Expires of 140, but the next plain hit still finds an old
cache entry (and refreshes it so the next plain one gets a HIT).
More information about the nginx