using $upstream* variables inside map directive

Francis Daly francis at daoine.org
Thu Nov 12 08:34:06 UTC 2020


On Thu, Nov 12, 2020 at 02:33:49AM -0500, unoobee wrote:

Hi there,

> I tried using $upstream_http_content_length inside the map directive with
> the "volatile" parameter to specify the proxy_cache behavior, but the map
> still uses the default value.

What's your config?

> Is there any way to set the proxy_cache behavior depending on
> $upstream_http_content_length via the map directive?

What proxy_cache behavior do you want to set?

You could reasonably set proxy_no_cache, because that only applies after
accessing upstream.

You can't usefully set proxy_cache, or proxy_cache_bypass, or
proxy_cache_key, because they are all consulted before the decision on
whether or not to access upstream has been made.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list