什么`expires -1`在NGINX`position`指令中意味着什么?

Jos*_*ell 7 caching nginx cache-control

鉴于location下面的示例,这-1意味着expires什么?这是否意味着"永不过期"或"永不缓存"?

# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
  expires -1;
  access_log logs/static.log;
}
Run Code Online (Sandbox Code Playgroud)

https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/expires.conf

Mar*_*555 11

根据nginx手册,该指令将HTTP ExpiresCache-Control标头添加到响应中.

-1表示这些标头设置为:

Expires: 当前时间减去1秒

Cache-Control: no-cache

总而言之,它指示浏览器不要缓存文档.


ste*_*ein 8

如果expires -1使用,则意味着这些页面永远不会被缓存。该expire指令指示浏览器在一定时间(或特定时间)后使文件缓存过期。如果给出负值,则不进行缓存。