Using 2 intersection of conditions for proxy_cache_bypass (avoiding logical if/and)

Jeroen Ooms jeroen.ooms at
Fri Jan 24 20:45:35 UTC 2014

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?

More information about the nginx mailing list