Proxy cache passes GET instead of HEAD to upstream

Maxim Dounin mdounin at mdounin.ru
Mon Feb 17 13:44:16 UTC 2014


Hello!

On Sat, Feb 15, 2014 at 02:23:26AM +0400, Valentin V. Bartenev wrote:

> On Friday 14 February 2014 17:11:37 jove4015 wrote:
> [..]
> > Is there any way to set up the proxy to the upstream so that it proxies HEAD
> > requests as HEAD requests, and GET requests as normal, and still caches
> > responses as well?  Ideally it would cache all GET responses, check against
> > the cache for HEAD requests, and proxy HEAD requests for objects not in the
> > cache as HEAD requests (thereby not caching the response, or only caching
> > the HEAD response as a separate object - ideally the latter but I could live
> > with the former).
> > 
> 
> You can set:
> 
>   proxy_cache_methods GET;
> 
> in this case HEAD requests will bypass cache.

No, this won't work.  HEAD and GET requests are always added to 
the proxy_cache_methods mask.

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



More information about the nginx mailing list