Welcome! Log In Create A New Profile

Advanced

Re: proxy cache

Michał Jaszczyk
May 19, 2009 09:39AM
>> 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?


>> 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.

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

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.

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.

Am I right?

Regards,

--
Michał Jaszczyk
Subject Author Posted

proxy cache

Michał Jaszczyk May 19, 2009 08:57AM

Re: proxy cache

Igor Sysoev May 19, 2009 09:13AM

Re: proxy cache

Michał Jaszczyk May 19, 2009 09:39AM

Re: proxy cache

Igor Sysoev May 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: 295
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