http 500 errors are not cached but go to the backend
nginx-forum at nginx.us
Tue Jan 8 10:19:29 UTC 2013
> Just a side note: the fastcgi_cache_lock directive doesn't affect
> update of the cache, it only affects adding new items to the
> cache. To handle cache updating the "fastcgi_cache_use_stale
> updating" should be used (it's actually already in your config).
Ok, that's good to know.
> fastcgi_cache_use_stale http_500;
> in your config instructs nginx to don't cache 500 response but
> return stale cached content instead. As soon as original cached
> resource expires - nginx starts to ask backend about new response,
> but since 500 is returned it returns stale response to clients
> In your case the behaviour looks a bit confusing as "original
> cached resource" above is the same 500 response (cached as
> fastcgi_cache_use_stale don't affect initial content caching), but
> the behaviour is as expected with your configuration - when you
> ask nginx to cache 500 responses and to don't use 500 responses
> for cache update at the same time.
Ok, got it. That was indeed confusing. Thanks for your explanation.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,234691,234782#msg-234782
More information about the nginx