Hello! On Wed, Dec 10, 2014 at 10:00:25PM -0500, new299 wrote:
> When the upstream goes away nginx gives the error "502 Bad Gateway > nginx/1.4.6 (Ubuntu)". The log contains: > > " [error] 2624#0: *48941 connect() failed (111: Connection refused) while > connecting to upstream," > > Rather than serving it from cache as I would expect. It should be cached as > the page was previous returned successfully. The problem is in the "it should be cached" statement. There are lots of cases when pages will not be cached even if returned - for example, because caching is explicitly disabled by response headers, or just not enabled and/or disabled with proxy_cache_min_uses, see Ruslan's answer. So in your case the response is likely _not_ cached, and that's why "proxy_cache_use_stale" doesn't work for you. To be sure you can follow Ruslan's suggestion to look into the cache directory, or use the $upstream_cache_status variable, see http://nginx.org/r/$upstream_cache_status. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
