fastcgi_cache_bypass and 502 Bad Gateway

Maxim Dounin mdounin at
Fri Feb 11 21:05:17 MSK 2011


On Fri, Feb 11, 2011 at 12:07:52PM -0500, kaspars wrote:

> [quote]$test will always be equal to 0 as any variable set within the
> 'if' block is not exposed outside the block AFAIK.[/quote]
> No. I am already using this check successfully for the fastcgi_no_cache
> rule.
> The real problem is with the *fastcgi_cache_bypass*. My understanding is
> that if "fastcgi_cache_bypass 1", then Nginx will request a fresh
> response from the backend and cache that response for further use where
> "fastcgi_cache_bypass 0".
> Is that how fastcgi_cache_bypass should work?

Yes, it's how it should work.  But this isn't really how it works 
now - due to bug behaviour is undefined if fastcgi_cache_bypass 
isn't the same as fastcgi_no_cache (and the same applies to 
proxy_cache_bypass/proxy_no_cache and so on).

This is known issue and I believe Igor worked on patching this.  
Avoid using different *_cache_bypass/*_no_cache until this is 

Maxim Dounin

More information about the nginx mailing list