Force cache refresh
Igor Sysoev
igor at sysoev.ru
Fri Jun 18 18:19:36 MSD 2010
On Fri, Jun 18, 2010 at 01:22:25PM +0000, Ole Laursen wrote:
> > Igor Sysoev <igor at ...> writes:
> > > 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.
>
> Hm, I think I might have been too hasty there. I can't get it to
> work with 0.7.67.
>
> If I send a request with a special header that goes to proxy_no_cache,
> then it always goes to the back-end as expected. But the response
> isn't cached, at least if I send the same request without the
> header, I get a back-end hit.
>
> Configuration looks like this:
>
> location / {
> proxy_pass http://127.0.0.1:7000;
> proxy_cache defaultzone;
> proxy_cache_valid 200 302 30s;
> proxy_cache_key "$request_uri";
> proxy_no_cache $http_x_refresh_cache;
> }
>
> The cache is otherwise working fine, with two plain requests in a
> row I only see the first one hit the back-end (I think this is what
> fooled me first time).
>
> Is this a bug?
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.
proxy_cache_valid does not work in this case.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list