Cache vs expires time

Maxim Dounin mdounin at mdounin.ru
Mon Jan 7 02:47:47 UTC 2019


Hello!

On Sun, Jan 06, 2019 at 03:07:00PM +0200, Andrei wrote:

> I was wondering how can I force cache of a $request_uri (/abc) for 10
> minutes, but set the browser expires headers for  5 minutes?

The most basic options are:

- You can set Expires from your backend as desired for browser 
  caching, and use the X-Accel-Expires header to set caching time 
  for nginx (see http://nginx.org/r/proxy_cache_valid).

- You can configure nginx to ignore Expires and Cache-Control as 
  set by your backend (see http://nginx.org/r/proxy_ignore_headers), 
  so these will be used only by browsers, and set caching time for 
  nginx manually with proxy_cache_valid (see 
  http://nginx.org/r/proxy_cache_valid).

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list