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 observed in debug log as "http map started" message). In case I use non-upstream related variables, a map works as expected.
Question: is there any way to use $upstream* vars inside the map directive, or maybe someone can offer alternative way to detect small upstream response in order to bypass cache?
Thank you.