Using 2 intersection of conditions for proxy_cache_bypass (avoiding logical if/and)
Jonathan Kolb
kolbyjack at gmail.com
Sat Jan 25 13:24:25 UTC 2014
You can chain two maps to get a logical and:
map $request_method $is_get {
default 0;
GET 1;
}
map $http_cache_bypass $bypass_cache {
default $is_get;
"" 0;
}
proxy_cache_methods POST;
proxy_cache_bypass $bypass_cache;
# note the lack of : after default in the maps, it's incorrect to have it
there like your original map did
On Fri, Jan 24, 2014 at 10:03 PM, B.R. <reallfqq-nginx at yahoo.fr> wrote:
> Hello,
>
> On Sat, Jan 25, 2014 at 3:40 AM, Jeroen Ooms <jeroen.ooms at stat.ucla.edu>wrote:
>
>> 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".
>>
>> *snip*
>>
>> Maybe someone from the nginx team can comment if this is a viable
>> solution?
>>
>
> You explicited clearly you wanted to avoid if/and logic in your message
> subject (one could wonder why since there appears to be no other trivial
> solution)...
> In the end, since proxy_cache_bypass doc clearly state that it works based
> on an OR logic, what you wish won't happen magically.
>
> With those conditions set, I hardly see something that won't look edgy...
>
> Maybe someone else could help you better.
> Good luck,
> ---
> *B. R.*
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140125/72098f6f/attachment.html>
More information about the nginx
mailing list