# Proxy Cache 502 Problem

**URL:** <https://www.ruby-forum.com/t/proxy-cache-502-problem/195856>\
**Category:** NGINX\
**Created:** [October 1, 2010, 11:33am UTC](https://www.ruby-forum.com/t/proxy-cache-502-problem/195856 "2010-10-01T11:33:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@gsyi](https://www.ruby-forum.com/u/gsyi)\
**Post date:** [October 1, 2010, 11:33am UTC](https://www.ruby-forum.com/t/proxy-cache-502-problem/195856/1 "2010-10-01T11:33:49Z")

</div>

WeÂ´re trying to cache all of our JS files using Proxy Cache from  
HttpProxyModule but somehow we always get confused responses from the  
server, sometimes we get a 502 error and sometimes we get the cached JS  
files… heres the config:

proxy\_temp\_path /tmp/proxy/proxy\_temp\_path;  
proxy\_cache\_path /tmp/proxy/proxy\_cache\_path levels=1:2  
keys\_zone=cache\_one:10m inactive=1d max\_size=5m;

```
 location ~ .*\.(js)$
 {
   proxy_cache cache_one;
   proxy_pass http://localhost:8080;
         proxy_cache_valid 200 1h;
         proxy_cache_use_stale error timeout invalid_header;
 }

```

Anyone who can help out?

Posted at Nginx Forum:

> **[Proxy Cache 502 Problem](https://forum.nginx.org/read.php?2,135926,135926#msg-135926)**
>
> We´re trying to cache all of our JS files using Proxy Cache from HttpProxyModule but somehow we always get confused responses from the server, sometimes we get a 502 error and sometimes we get the cached JS files... heres the config: proxy\_temp\_path...

---

<div class="post-metadata">

**Author:** ![gsyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@gsyi](https://www.ruby-forum.com/u/gsyi)\
**Post date:** [October 2, 2010, 7:13am UTC](https://www.ruby-forum.com/t/proxy-cache-502-problem/195856/2 "2010-10-02T07:13:11Z")

</div>

Nobody there who can help out? What am I actually doing wrong? Proxy  
Cache is activated on the application servers behind of the nginx load  
balancers, but the results are really unstable…

Posted at Nginx Forum:

> **[Re: Proxy Cache 502 Problem](https://forum.nginx.org/read.php?2,135926,136201#msg-136201)**
>
> We´re trying to cache all of our JS files using Proxy Cache from HttpProxyModule but somehow we always get confused responses from the server, sometimes we get a 502 error and sometimes we get the cached JS files... heres the config: proxy\_temp\_path...
