Using 2 intersection of conditions for proxy_cache_bypass (avoiding logical if/and)

Jeroen Ooms jeroen.ooms at
Sat Jan 25 02:40:27 UTC 2014

On Fri, Jan 24, 2014 at 1:04 PM, B.R. <reallfqq-nginx at> wrote:
> Does the following work?

This looks like a fragile solution. You're basically simulating an
"if", but I don't think we should assume that nginx will resolve all
maps in the defined order, as would be using "if".

The nginx documentation for HttpMapModule says: "The map directive
creates the variable, but only performs the mapping operation when
(and if) the variable is accessed." In your solution, $bypass is
already set to "true" a-priori, and also defined in two maps. I doubt
nginx will resolve those maps, in the right order, to arrive at the
desired value of $bypass.

Maybe someone from the nginx team can comment if this is a viable solution?

More information about the nginx mailing list