Cache vs expires time

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


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

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

Maxim Dounin

More information about the nginx mailing list