разобрались тут: http://forum.nginx.org/read.php?2,249880,249894#msg-249894by Kirill K. - Nginx Mailing List - Russian
Ruslan, you're a hero! I just commented the following line in my existing config #proxy_cache_bypass $dontcache; and everything works now! I won't be able to comprehend such nginx's behaviour w/o your help, greatly appreciated.by Kirill K. - Nginx Mailing List - English
Thanks, Ruslan, Thing is, I tried to "debug" whether $dontcache is being set at all by exposing it via response headers (along with content-length), and it shows that $upstream_response_length is ignored by map completely, i.e. no matter where I use $dontcache, it will never get any value different from default (i.e. 0). Even though $upstream_response_length is validated correctly (andby Kirill K. - Nginx Mailing List - English
Probably that's the case, and I'm not sure if there's a way to use map inside upstream {...} or other context apart from http {...}, which makes your theory sound correct. What confuses me most: I googled a bit, and using map w/ $upstream_response_length is the most common way offered to avoid caching of small (or zero-sized) responses, yet it just does not work in a real life scenario...by Kirill K. - Nginx Mailing List - English
Hello, I'm trying to avoid caching of small responses from upstreams using map: map $upstream_http_content_length $dontcache { default 0; ~^\d\d$ 1; ~^\d$ 1; } Unfortunatelly, nginx seems to ignore $upstream* variables at the map processing stage, hence variables like $upstream_http_content_length or $upstream_response_length stay empty when map directive is processed (this can be observeby Kirill K. - Nginx Mailing List - English
Приветствую, Пытаюсь избежать кеширования мелких ответов от апстрима таким образом: map $upstream_http_content_length $dontcache { default 0; ~^\d\d$ 1; ~^\d$ 1; } Но столкнулся с тем, что, судя по всему, nginx обрабатывает map до того, как пby Kirill K. - Nginx Mailing List - Russian