4 messages in ru.sysoev.nginxRe: proxy cache
FromSent OnAttachments
Michał JaszczykMay 19, 2009 5:57 am 
Igor SysoevMay 19, 2009 6:12 am 
Michał JaszczykMay 19, 2009 6:39 am 
Igor SysoevMay 19, 2009 6:44 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: proxy cacheActions...
From:Michał Jaszczyk (jasi@gmail.com)
Date:May 19, 2009 6:39:36 am
List:ru.sysoev.nginx

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,