Client Cache Time vs. Server Cache Time

Maxim Dounin mdounin at mdounin.ru
Wed Jul 11 15:31:38 UTC 2012


Hello!

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

> 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?

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:

http://nginx.org/r/proxy_ignore_headers
http://nginx.org/r/proxy_cache_valid

Maxim Dounin



More information about the nginx mailing list