Welcome! Log In Create A New Profile

Advanced

Re: combining map

Igor A. Ippolitov
March 09, 2017 03:54AM
No, it won't.

You can try something like

map $request_method $requestnocache {
default "";
POST whatever;
}
map $requestnocache$query_string$cookie__mcnc $skip_cache {
default 0;
~. 1;
}

So basically, "don't skip by default, but skip, if there are any letters"
You can test this by extending your log format with variables
used/produced by the map and comparing results to what you expect there
to be.

On 09.03.2017 11:35, Anoop Alias wrote:
> Hi Igor,
>
> I need to use this with
>
> ##################
> srcache_fetch_skip $skip_cache;
> srcache_store_skip $skip_cache;
> ##################
>
> As per srcache docs the value must be 0 for not skipping and anything
> other than 0 will be considered for skipping
>
> Will combining the variables work here too?
>
> Thanks,
>
> On Thu, Mar 9, 2017 at 1:39 PM, Igor A. Ippolitov
> <iippolitov@nginx.com <mailto:iippolitov@nginx.com>> wrote:
>
> If you are going to use it inside proxy_no_cache directive, you
> can combine proxy_cache_method (POST is not included by default)
> and 'proxy_no_cache $query_string$cookie__mcnc'
> The latter will not cache the request until there is query string
> or a cookie with a value set.
> So basically, it looks like you can avoid using maps in this case.
>
>
> On 09.03.2017 10:01, Anoop Alias wrote:
>> Hi,
>>
>> I have 3 maps defined
>> ############################
>> map $request_method $requestnocache {
>> default 0;
>> POST 1;
>> }
>>
>> map $query_string $querystringnc {
>> default 1;
>> "" 0;
>> }
>>
>> map $http_cookie $mccookienocache {
>> default 0;
>> _mcnc 1;
>> }
>> ###############################
>>
>> I need to create a single variable that is 1 if either of the 3
>> above is 1 and 0 if all are 0. Will the following be enough
>>
>> map "$requestnocache$querystringnc$mccookienocache" {
>> default 0;
>> ~1 1;
>> }
>>
>>
>>
>> Thanks,
>> --
>> *Anoop P Alias*
>>
>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org <mailto:nginx@nginx.org>
>> http://mailman.nginx.org/mailman/listinfo/nginx
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
> _______________________________________________ nginx mailing list
> nginx@nginx.org <mailto:nginx@nginx.org>
> http://mailman.nginx.org/mailman/listinfo/nginx
> http://mailman.nginx.org/mailman/listinfo/nginx
>
> --
> *Anoop P Alias*
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Re: combining map

Igor A. Ippolitov March 09, 2017 03:10AM

Re: combining map

Anoop Alias March 09, 2017 03:36AM

Re: combining map

Igor A. Ippolitov March 09, 2017 03:54AM

Re: combining map

ru@nginx.com March 09, 2017 04:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 251
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready