如何告诉Chrome不要过早使用本地缓存

时间:2015-07-29 03:02:15

标签: http caching nginx http-caching

该页面(只是一个静态.html)与以下标题一起提供:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 29 Jul 2015 02:59:37 GMT
Content-Type: text/html; charset=utf-8
Last-Modified: Wed, 29 Jul 2015 02:53:23 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Content-Encoding: gzip

然后,我关闭标签页,再次打开页面(通过手动输入网址)并获得下一个响应:

HTTP/1.1 304 Not Modified
Server: nginx
Date: Wed, 29 Jul 2015 02:58:45 GMT
Last-Modified: Wed, 29 Jul 2015 02:53:23 GMT
Connection: keep-alive
ETag: "55b84023-1ad"

我重复了几次,然后Chrome停止从服务器请求它并直接从其缓存中提供。

Status Code:200 OK (from cache)
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Wed, 29 Jul 2015 02:59:56 GMT
Last-Modified:Wed, 29 Jul 2015 02:53:23 GMT
Server:nginx
Vary:Accept-Encoding

有没有办法(服务器端)告诉Chrome不要这样做,但是尊重每个请求的HTTP缓存标头?

0 个答案:

没有答案