# Re: proxy\_cache\_bypass and proxy\_no\_cache

**URL:** <https://www.ruby-forum.com/t/re-proxy-cache-bypass-and-proxy-no-cache/225063>\
**Category:** NGINX\
**Created:** [December 10, 2012, 3:09pm UTC](https://www.ruby-forum.com/t/re-proxy-cache-bypass-and-proxy-no-cache/225063 "2012-12-10T15:09:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 10, 2012, 3:09pm UTC](https://www.ruby-forum.com/t/re-proxy-cache-bypass-and-proxy-no-cache/225063/1 "2012-12-10T15:09:45Z")

</div>

> ```
> set $dont_cache 0;
> 
> ```
> 
> it.  
> You have to set it at the server level to make it work.

set $dont\_cache 1;

if ($cookie\_route) {  
set $dont\_cache 0;  
}

location /test {  
proxy\_pass [http://a/](http://a/);  
proxy\_cache\_bypass $dont\_cache;  
proxy\_no\_cache $dont\_cache;  
}

If creates an implicit location.

If is evil: [If is Evil… when used in location context | NGINX](http://wiki.nginx.org/IfIsEvil)

As Igor said above use map and get clear of the if directive quirks.

–appa
