fastcgi_cache_bypass and 502 Bad Gateway

kaspars nginx-forum at
Fri Feb 11 19:31:15 MSK 2011

> AFAIK, the '$donot_cache ' you set here 
> will not contain anything outside the if block.

You are right, I forgot to put "set $donot_cache = 0;" right before the
if block, but it doesn't seem to be the problem.

Everything is fine regarding the availability of those variables, and I
verified it by adding them as an HTTP header to all responses.

> In your case, why not just use 'fastcgi_no_cache 
> $cookie_COOKIE-1$cookie_COOKIE-2$cookie_COOKIE-3' 
> and skip the whole 'if' test?

Because those cookie names change -- they have random numbers appended
to them, so I need to do a regex check for their prefixes.

I'll be sure to post an update if I find something.

Posted at Nginx Forum:,173795,174184#msg-174184

More information about the nginx mailing list