# Client Cache Time vs. Server Cache Time

**URL:** <https://www.ruby-forum.com/t/client-cache-time-vs-server-cache-time/221370>\
**Category:** NGINX\
**Created:** [July 11, 2012, 3:16pm UTC](https://www.ruby-forum.com/t/client-cache-time-vs-server-cache-time/221370 "2012-07-11T15:16:24Z")\
**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:** [July 11, 2012, 3:16pm UTC](https://www.ruby-forum.com/t/client-cache-time-vs-server-cache-time/221370/1 "2012-07-11T15:16:24Z")

</div>

Hi Guys,

I’d like to setup a reverse proxy that functions as follows.

Servers responds telling the client to cache content for 1 hour, but a  
the same time tells Nginx to cache the content for 24 hours.

Every hour client still re-request content but it’s served from cache.

If something changes on the origin servers I can still dump the cache on  
Nginx, which will get a fresh copy.

Is something like this currently supported?

Thanks  
Warrick

Posted at Nginx Forum:

> **[Client Cache Time vs. Server Cache Time](https://forum.nginx.org/read.php?2,228499,228499#msg-228499)**
>
> Hi Guys, I'd like to setup a reverse proxy that functions as follows. Servers responds telling the client to cache content for 1 hour, but a the same time tells Nginx to cache the content for 24 hours. Every hour client still re-request content but...

---

<div class="post-metadata">

**Author:** ![WarrickF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c37758/32.png) [@WarrickF](https://www.ruby-forum.com/u/WarrickF)\
**Post date:** [July 11, 2012, 5:31pm UTC](https://www.ruby-forum.com/t/client-cache-time-vs-server-cache-time/221370/2 "2012-07-11T17:31:57Z")

</div>

Hello!

On Wed, Jul 11, 2012 at 09:15:53AM -0400, WarrickF wrote:

> Nginx, which will get a fresh copy.
> 
> Is something like this currently supported?

Yes.

1. Instruct nginx to ignore Cache-Control / Expires headers you  
use to control expiration on client.

2. Either use explicit expiration set by proxy\_cache\_valid, or use  
X-Accel-Expires header to control expiration from backend.

See here for more details:

> **[Module ngx\_http\_proxy\_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers)**
>
> The ngx\_http\_proxy\_module module allows passing requests to another server.

> **[Module ngx\_http\_proxy\_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid)**
>
> The ngx\_http\_proxy\_module module allows passing requests to another server.

Maxim D.
