# Proxy\_cache\_use\_stale updating

**URL:** <https://www.ruby-forum.com/t/proxy-cache-use-stale-updating/243304>\
**Category:** NGINX\
**Created:** [September 9, 2015, 12:38pm UTC](https://www.ruby-forum.com/t/proxy-cache-use-stale-updating/243304 "2015-09-09T12:38:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [September 9, 2015, 12:38pm UTC](https://www.ruby-forum.com/t/proxy-cache-use-stale-updating/243304/1 "2015-09-09T12:38:18Z")

</div>

I’ve one storage server using nginx, one cache file server using nginx.  
The following are my configuration files:

1. storage\_server.conf(ip address 192.168.1.10):  
server {  
listen 80;  
listen [::]:80 ipv6only=on;  
server\_name \_;

```
location / {
    return 403;
}

```

location ~ ^/cache/ {  
root /var/my\_file\_storage;  
directio 1m;  
directio\_alignment 8k;  
output\_buffers 1 1m;  
try\_files $request\_uri =404;  
}  
}

1. cache\_server.conf(ip address 192.168.1.2):  
proxy\_cache\_path /nginx-cache/cache-level1/cache levels=1  
keys\_zone=CacheLVL1:10m inactive=12h max\_size=5G;  
server {  
listen 80;  
listen [::]:80 ipv6only=on;  
server\_name \_;

```
location / {
    return 403;
}

location ~ ^/cache/ {
    proxy_pass http://192.168.1.10:80$request_uri; #

```

request\_uri is path to file on Storage server.  
proxy\_cache CacheLVL1;  
proxy\_cache\_key $request\_uri;  
proxy\_cache\_valid 200 30d;  
proxy\_temp\_path /nginx-cache/cache-level1/temp;  
proxy\_cache\_use\_stale updating;  
proxy\_max\_temp\_file\_size 0;  
add\_header X-Proxy-Cache $upstream\_cache\_status;  
proxy\_set\_header Range $http\_range;  
proxy\_set\_header If-Range $http\_if\_range;  
}  
}  
/etc/nginx/nginx.conf  
…{  
…  
log\_format upstreamlog ‘[$time\_local] $remote\_addr to $upstream\_addr  
$upstream\_cache\_status’;  
access\_log /var/log/nginx/cache.log upstreamlog;  
…  
}

I’ve read about proxy\_cache\_use\_stale updating. But I do not understand  
how its activities:  
1.  
[http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html#proxy\_cache\_use\_stale:](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_use_stale:)  
the updating parameter permits using a stale cached response if it is  
currently being updated. This allows minimizing the number of accesses  
to proxied servers when updating cached data.  
2. [Proxy\_cache\_use\_stale - NGINX - Ruby-Forum](https://www.ruby-forum.com/topic/212402#new:) “If I understand this  
right if I use proxy\_cache\_use\_stale updating and  
If I have 1000 users trying to access expired cached information. It  
will only send one request to backend server to update the cache ?”

I request multiple times and received multiple files in the  
/nginx-cache/cache-level1/temp folder 000000xx format. I think I have  
the wrong configuration in my configuration file because it works unlike  
what I’ve read. I never saw the $ upstream\_cache\_status UPDATING in  
cache.log.  
It is related to X-Accel-Expires “,” Expires “,” Cache-Control "is not?  
Can someone explain to proxy\_cache\_use\_stale updating your help, Thank!
