Welcome! Log In Create A New Profile

Advanced

Re: Force cache refresh

June 18, 2010 10:26AM
On Fri, Jun 18, 2010 at 01:22:25PM +0000, Ole Laursen wrote:

> > Igor Sysoev <igor@...> 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/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Force cache refresh

Ole Laursen June 17, 2010 02:30PM

Re: Force cache refresh

Igor Sysoev June 17, 2010 02:38PM

Re: Force cache refresh

Ole Laursen June 18, 2010 06:36AM

Re: Force cache refresh

Ole Laursen June 18, 2010 09:26AM

Re: Force cache refresh

Igor Sysoev June 18, 2010 10:26AM

Re: Force cache refresh

Ole Laursen June 19, 2010 01:32PM

Re: Force cache refresh

Ole Laursen June 21, 2010 06:52AM

Re: Force cache refresh

mschipperheyn January 18, 2011 07:49PM

Re: Force cache refresh

Simon Liu January 19, 2011 03:22AM

Re: Force cache refresh

Scott Smith June 17, 2010 03:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready