Using 2 intersection of conditions for proxy_cache_bypass (avoiding logical if/and)
António P. P. Almeida
appa at perusio.net
Sat Jan 25 02:57:41 UTC 2014
map $http_cache_control$request_method $no_cache {
default 0;
~^.+GET$ 1;
}
proxy_cache_methods POST;
proxy_cache_bypass $no_cache;
proxy_no_cache $no_cache;
----appa
---------- Forwarded message ----------
From: Jeroen Ooms <jeroen.ooms at stat.ucla.edu>
Date: Fri, Jan 24, 2014 at 9:45 PM
Subject: Using 2 intersection of conditions for proxy_cache_bypass
(avoiding logical if/and)
To: nginx at nginx.org
I use nginx to cache both GET and POST requests. I want to use
proxy_cache_bypass to allow users to bypass the cache, but ONLY for
GET requests. POST requests should always be cached. I tried this:
map $request_method $is_get {
default: "";
GET "true";
}
proxy_cache_methods POST;
proxy_cache_bypass $http_cache_control $is_get;
However, this bypasses the cache when either $http_cache_control OR
$is_get is set. How can I achieve to set proxy_cache_bypass when both
http_cache_control AND $is_get are set?
_______________________________________________
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/5132a7a3/attachment.html>
More information about the nginx
mailing list