Search code examples
nginxcache-control

expires the next day at 06:00 a.m


Currently I use this nginx config to cache index.html for one day:

location /index.html {
  gzip_static on;
  expires 1d;
  add_header Cache-Control public;
  break;
}

Is there a way to configure that the cache always expires the next day at 06:00 a.m.?


Solution

  • http://nginx.org/en/docs/http/ngx_http_headers_module.html#expires

    In addition, it is possible to specify a time of the day using the “@” prefix (0.7.9, 0.6.34):

       expires @15h30m;