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 <[email protected]>
Date: Fri, Jan 24, 2014 at 9:45 PM
Subject: Using 2 intersection of conditions for proxy_cache_bypass
(avoiding logical if/and)
To: [email protected]


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
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to