proxy_cache_bypass and proxy_no_cache

amodpandey nginx-forum at
Mon Dec 10 10:15:11 UTC 2012

Thank you :) This one worked.

I would like to take this opportunity to share the exact problem I had.

I am using sticky module for some app version targetting. Plus I have
enabled proxy cache. The sticky module works in a way that it first let the
upstream handle the weights and according to which server catered the
response it set cookie with server info hash. So the response that is cached
is without cookie.

So in this case even proxy_no_store $http_set_cookie does not work. So the
only way I could think was to change the caching behaviour to cache only
requests with my cookie.

There is only proxy_no_store ( proxy_store does something else ) so I need
to negate the value, if set. Here the map helped me to achieve the same.

But I wish there could have been a straight forward way.

I had this followup question 

Why we need to have proxy_cache_bypass and proxy_no_cache else
nginx: [warn] "proxy_no_cache" functionality has been changed in 0.8.46, now
it should be used together with "proxy_cache_bypass"

Posted at Nginx Forum:,233778,233786#msg-233786

More information about the nginx mailing list