Nginx multiple upstream map conditions

Francis Daly francis at
Wed Aug 31 21:57:22 UTC 2016

On Wed, Aug 31, 2016 at 01:30:30PM -0400, c0nw0nk wrote:

Hi there,

> Thanks works a treat is it possible or allowed to do the following in a
> nginx upstream map ? and if so how i can't figure it out.

I think it is logically impossible.

> I cache with the following key.
> fastcgi_cache_key
> "$session_id_value$scheme$host$request_uri$request_method";

fastcgi_cache_key is the thing that nginx calculates from the request,
before it decides whether to send the response from cache, or whether
to pass the request to upstream.

> if the upstream_cookie_logged_in value is not equal to 1 how can I set
> $session_id_value ''; make empty

$upstream_cookie_something is part of the response from upstream,
so is not available to nginx at the time that it is calculating
fastcgi_cache_key for the "read from cache or not" decision.

Am I missing something?

Francis Daly        francis at

More information about the nginx mailing list