Welcome! Log In Create A New Profile

Advanced

Re: proxy cache

May 19, 2009 09:44AM
On Tue, May 19, 2009 at 03:39:59PM +0200, Micha?? Jaszczyk wrote:

> >> 1. proxy_cache_valid is set to 1h and upstream's response is valid for 2h.
> >
> > nginx will cache for 2h.
> >
> >> 2. proxy_cache_valid is set to 2h and upstream's response is valid for 1h.
> >
> > nginx will cache for 1h.
> >
> >> 3. proxy_cache_valid is set to 1h and upstream's response doesn't
> >> contain any caching hints.
> >
> > nginx will cache for 1h.
>
> This just means that upstream's caching instructions are more
> important than proxy_cache_valid, right?

Yes, the order is

X-Accel-Expires
Expires/Cache-Control
proxy_cache_valid

However, you may ignore the headers using

proxy_ignore_headers X-Accel-Expires Expires Cache-Control;

> >> What happens if the client sends "If-Modified-Since" header?
> >
> > This header does not send to backend, however, nginx may responses 304.
>
> I'm not sure if I understand. Let's imagine some scenarios (I-M-S
> stands for If-Modified-Since, L-M stands for Last-Modified):
>
> 1. Client sends I-M-S, Nginx has response in cache, cached response
> has L-M < I-M-S, Nginx sends 304.

Yes. Small note, by default nginx sends 304 only if L-M == I-M-S.
Controlled by if_modified_since [off|exact|before] directive

> 2. Client sends I-M-S, Nginx has response in cache, cached response
> has L-M > I-M-S, Nginx serves response from cache.

Yes.

> 3. Client sends I-M-S, Nginx doesn't have response in cache, sends
> request to upstream, upstream's L-M < I-M-S, Nginx stores response in
> cache and sends 304.

Yes.

> 4. Client sends I-M-S, Nginx doesn't have response in cache, sends
> request to upstream, upstream's L-M > I-M-S, Nginx stores response in
> cache and sends response from upstream.

Yes.

> Am I right?
>
> Regards,
>
> --
> Micha?? Jaszczyk


--
Igor Sysoev
http://sysoev.ru/en/
SubjectAuthorPosted

proxy cache

Michał JaszczykMay 19, 2009 08:57AM

Re: proxy cache

Igor SysoevMay 19, 2009 09:13AM

Re: proxy cache

Michał JaszczykMay 19, 2009 09:39AM

Re: proxy cache

Igor SysoevMay 19, 2009 09:44AM

Re: proxy cache

Sam H.November 04, 2010 10:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 65
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 184 on July 08, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready