Chrome不会发送“If-Modified-Since” [英] Chrome doesn't send "If-Modified-Since"

查看:565
本文介绍了Chrome不会发送“If-Modified-Since”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望浏览器始终添加(除了第一次)If-Modified-Since请求标头以避免不必要的流量。

I want browsers to always add (except first time) "If-Modified-Since" request header to avoid unnecessary traffic.

响应头是:

Accept-Ranges:bytes
Cache-Control:max-age=0, must-revalidate
Connection:Keep-Alive
Content-Length:2683
Content-Type:text/html; charset=UTF-8
Date:Thu, 05 Apr 2012 13:06:19 GMT
Keep-Alive:timeout=15, max=497
Last-Modified:Thu, 05 Apr 2012 13:05:11 GMT
Server:Apache/2.2.21 (Red Hat)

FF 11和IE 9都发送If-Modified-Since并得到304作为响应,但Chrome 18没有得到200.

FF 11 and IE 9 both send "If-Modified-Since" and get 304 in response but Chrome 18 doesn't and get 200.

为什么?如何强制Chrome发送If-Modified-Since标题?
我不知道它是否重要但是所有请求都通过HTTPS。

Why? How to force Chrome to sent "If-Modified-Since" header? I do not know if it important or not but all requests going through HTTPS.

推荐答案

我一直在追逐这个问题一段时间,以为我会分享我找到的东西。

I've been chasing this issue for some time, thought I'd share what I found.

规则实际上很简单:证书的任何错误都意味着页面不会被缓存。

"The rule is actually quite simple: any error with the certificate means the page will not be cached."

https://code.google.com/p/chromium/issues/detail?id= 110649

如果您使用的是自签名证书,即使您告诉Chrome为其添加例外以便加载页面,也不会有资源来自该页面将被缓存,后续请求将没有If-Modified-Since标头。

If you are using a self-signed certificate, even if you tell Chrome to add an exception for it so that the page loads, no resources from that page will be cached, and subsequent requests will not have an If-Modified-Since header.

这篇关于Chrome不会发送“If-Modified-Since”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆