# Proxy\_cache/story and busylocks workaround

**URL:** <https://www.ruby-forum.com/t/proxy-cache-story-and-busylocks-workaround/214373>\
**Category:** NGINX\
**Created:** [November 30, 2011, 11:19am UTC](https://www.ruby-forum.com/t/proxy-cache-story-and-busylocks-workaround/214373 "2011-11-30T11:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [November 30, 2011, 11:19am UTC](https://www.ruby-forum.com/t/proxy-cache-story-and-busylocks-workaround/214373/1 "2011-11-30T11:19:25Z")

</div>

proxy\_cache workaround:

http{  
proxy\_cache\_path /cache keys\_zone=localcache:10m;  
limit\_zone perUri $uri 10m;  
}  
server {  
location /remote/ {  
try\_files $uri @fake @proxy-remote;  
}  
location @fake {  
root /notexists;  
}  
location @proxy-remote {  
limit\_conn perUri 1;  
proxy\_cache localcache;  
proxy\_cache\_valid any 999d;  
proxy\_cache\_key “remote$request\_uri”; # fix to suit your  
needs  
proxy\_set\_header Range “”; # don’t pass range requests  
to upstream in this section, otherwise response won’t be cached  
proxy\_pass upstream;  
error\_page 503 = @locked-remote;  
}  
location @locked-remote {  
# take your own. e.g.:  
proxy\_buffering off;  
proxy\_pass upstream;  
}  
# copy paste locations if you need (feel free to share common  
@fake)  
}

[http://pastie.org/private/meuzkrrvanhgojuoz0mvxa](http://pastie.org/private/meuzkrrvanhgojuoz0mvxa)

In case of proxy\_store just remove @fake and set right root in /remote/

This is just a PoC, so you have to change it up to your needs.  
It really works and nginx really rox =]  
Any questions? - Welcome

icq:3016467 skype:imperial.roaming

Posted at Nginx Forum:

> **[proxy\_cache/story and busylocks workaround](https://forum.nginx.org/read.php?2,219354,219354#msg-219354)**
>
> proxy\_cache workaround: http{ proxy\_cache\_path /cache keys\_zone=localcache:10m; limit\_zone perUri $uri 10m; } server { location /remote/ { try\_files $uri @fake @proxy-remote; }

---

<div class="post-metadata">

**Author:** ![c0re](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9dc877/32.png) [@c0re](https://www.ruby-forum.com/u/c0re)\
**Post date:** [November 30, 2011, 11:56am UTC](https://www.ruby-forum.com/t/proxy-cache-story-and-busylocks-workaround/214373/2 "2011-11-30T11:56:00Z")

</div>

Sorry guys.  
There’s problem with workaround for proxy\_cache.  
So it works with proxy\_store only.

Posted at Nginx Forum:

> **[Re: proxy\_cache/story and busylocks workaround](https://forum.nginx.org/read.php?2,219354,219362#msg-219362)**
>
> proxy\_cache workaround: http{ proxy\_cache\_path /cache keys\_zone=localcache:10m; limit\_zone perUri $uri 10m; } server { location /remote/ { try\_files $uri @fake @proxy-remote; }
