Closed Daniel15 closed 10 years ago
This suggestion seems to be outdated, nginx always does a GET request to backend servers in order to fill the cache. You can safely store remove the request_method from your cache key in my opinion.
The advice from the wiki is incorrect, like @runningman84 said, nginx always changes HEAD
to GET
in cacheable locations.
I encountered this problem when I raised the issue (10 months ago) as I was encountering blank page loads and changing the cache key resolved it. Which Nginx version was this fixed in?
Just wanted to say here that this caused me a lot of searching - I used this:
fastcgi_cache_key "$scheme$request_method$host$request_uri";
Which cause mysterious 403 Not Allowed errors. Removing $request_method fixes the problem
The Nginx wiki suggests to have $request_method in the cache key:
However, this breaks the same location syntax, as it'd be looking for the incorrect cache key (with PURGE as the scheme instead of GET). I'd love to use the same location syntax, but I'm scared to remove $request_method from my cache key, knowing that a HEAD request hitting an uncached page will cache a blank page.