Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

using $upstream* variables inside map directive (no replies)

$
0
0
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.

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>