# Proxy\_cache not working for me

**URL:** <https://www.ruby-forum.com/t/proxy-cache-not-working-for-me/220846>\
**Category:** NGINX\
**Created:** [June 22, 2012, 12:46am UTC](https://www.ruby-forum.com/t/proxy-cache-not-working-for-me/220846 "2012-06-22T00:46:00Z")\
**Posts on this page:** 2\
**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:** [June 22, 2012, 12:46am UTC](https://www.ruby-forum.com/t/proxy-cache-not-working-for-me/220846/1 "2012-06-22T00:46:00Z")

</div>

http {

proxy\_cache\_path /dev/shm/cache/nginx/ levels=1:2  
keys\_zone=cache:30m inactive=1d max\_size=500M;  
proxy\_temp\_path /dev/shm/cache/nginx/tmp 1 2;  
proxy\_cache\_key “$scheme$request\_method$request\_uri”;

server {  
…

location / {  
add\_header X-Cache-Status $upstream\_cache\_status;  
proxy\_pass $scheme://default;  
proxy\_cache cache;  
proxy\_cache\_valid 200 30m;  
proxy\_cache\_min\_uses 1;  
proxy\_ignore\_headers “Expires” “Cache-Control”;  
proxy\_cache\_use\_stale error timeout invalid\_header http\_500;  
}

* * *

I am always getting a MISS. nginx 1.2.1

Response Header

Cache-Control:no-store, no-cache, must-revalidate, post-check=0,  
pre-check=0  
Connection:keep-alive  
Content-Encoding:gzip  
Content-Type:application/json  
Date:Thu, 21 Jun 2012 22:37:26 GMT  
Expires:Mon, 26 Jul 1997 05:00:00 GMT  
Pragma:no-cache  
Server:nginx  
Transfer-Encoding:chunked  
Vary:Accept-Encoding, Accept-Encoding  
X-Cache-Status:MISS  
X-Powered-By:PHP/5.3.6

Similar setting has worked for me on another set up! Could someone helpe  
me with some pointers.

Posted at Nginx Forum:

> **[proxy\_cache not working for me](https://forum.nginx.org/read.php?2,227796,227796#msg-227796)**
>
> http { proxy\_cache\_path /dev/shm/cache/nginx/ levels=1:2 keys\_zone=cache:30m inactive=1d max\_size=500M; proxy\_temp\_path /dev/shm/cache/nginx/tmp 1 2; proxy\_cache\_key "$scheme$request\_method$request\_uri"; server {

---

<div class="post-metadata">

**Author:** ![amodpandey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@amodpandey](https://www.ruby-forum.com/u/amodpandey)\
**Post date:** [June 22, 2012, 1:51am UTC](https://www.ruby-forum.com/t/proxy-cache-not-working-for-me/220846/2 "2012-06-22T01:51:30Z")

</div>

Somewhere in the configuration there was

proxy\_buffering off

🙂

I commented it and it started working.

Posted at Nginx Forum:

> **[Re: CLOSED proxy\_cache not working for me](https://forum.nginx.org/read.php?2,227796,227798#msg-227798)**
>
> http { proxy\_cache\_path /dev/shm/cache/nginx/ levels=1:2 keys\_zone=cache:30m inactive=1d max\_size=500M; proxy\_temp\_path /dev/shm/cache/nginx/tmp 1 2; proxy\_cache\_key "$scheme$request\_method$request\_uri"; server {
