if-none-match with proxy_cache : properly set headers

Maxim Dounin mdounin at mdounin.ru
Wed Jul 16 13:39:28 UTC 2014


Hello!

On Wed, Jul 16, 2014 at 02:14:54AM -0400, quoter wrote:

> Maxim Dounin Wrote:
> -------------------------------------------------------
> > Normally you shouldn't cache 304 responses from a backend, but 
> > rather cache 200 responses from a backend and let nginx to return 
> > 304 by its own.  This is how it works by default.
> > 
> > Do you have problems with the default aproach?
> 
> Yes I do have some problems with this approach. In our nginx config we use
> also option "fastcgi_cache_min_uses 5". So response body appears in cache
> only after 5 user requests. But for our production purposes it is extremely
> important to return 304 if client response has valid If-None-Match.

Yes, ..._cache_min_uses can lead to suboptimal behaviour in such a 
case.  It is planned to improve things to just pass If-* headers 
if caching was disabled due to ..._cache_min_uses.  No ETA though.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list