Mapping non-empty $query_string

Hi!
I’m running a Wordpress based website on my server, I’ve set up fastcgi
cache recently. Now I want to get rid of evil-ifs, that are used to
detect
cache skipping cases, and replace them with map.

I managed to convert all common ifs except this one,

if ($query_string != “”) {
set $skip_cache 1;
}

I’m trying to replace it with non-evil map in http section.

#skip cache if query string has at least one character
map $query_string $skip_cache {
“~.+” “1”;
}

For some reason it doesn’t work as intended. It starts bypassing cache
on
ALL pages except main page.

Thanks for any help.
Alex

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,267584,267584#msg-267584

On 15 Jun 2016, at 02:37, Supersmile2009 [email protected]
wrote:

I’m trying to replace it with non-evil map in http section.

#skip cache if query string has at least one character
map $query_string $skip_cache {
“~.+” “1”;
}

For some reason it doesn’t work as intended. It starts bypassing cache on
ALL pages except main page.

map $query_string $skip_cache {
“” 0;
default 1;
}


Igor S.
http://nginx.com

Already tried it, same result. Main page hits the cache, everything else

bypasses.

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,267584,267590#msg-267590

Are you sure your requests are processed by the right block?

Are you sure the configuration is being loaded? Since v1.9.2, you can
use
the -T command-line parameter to show loaded configuration.
On reloading configuration by sending the HUP signal, ensure there is no
error message popping up in the error logs.

If this still does not work no-one cannot help you without further
details
on the used configuration.

B. R.

On Wed, Jun 15, 2016 at 2:12 PM, Supersmile2009
<[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs