简体   繁体   English

浏览器不是在HTTPS中缓存图像(HTTP工作正常)。 即使使用Cache-Control:public

[英]Browser is not caching images in HTTPS (HTTP works fine). Even with Cache-Control: public

I'm trying to follow Google's caching recommendation , but neither IE nor Chrome are caching my images when HTTPS is used. 我正在尝试遵循Google的缓存建议 ,但在使用HTTPS时,IE和Chrome都无法缓存我的图像。 The second request is not even a conditional GET. 第二个请求甚至不是有条件的GET。 If I simply switch to HTTP, it works fine. 如果我只是切换到HTTP,它工作正常。

Here's request information, according to Chrome's request logger: 根据Chrome的请求记录器,这是请求信息:

Remote Address: ::1:443
Request URL: https://localhost/getmyimage.php?id=123
Request Method: GET
Status Code: 200 OK

Request Headers 请求标题

Accept: image/webp,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en;q=0.8
Connection: keep-alive
Cookie: PHPSESSID=gbk4vk7ejlr20nqgajcqgskul7
Host: localhost
Referer: https://localhost/
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36

Query String Parameters 查询字符串参数

id: 123

Response Headers 响应标题

Cache-Control: public
Connection: Keep-Alive
Content-Length: 3224
Content-Type: image/png
Date: Tue, 27 May 2014 06:53:03 GMT
Expires: Mon, 25 Aug 2014 06:53:03 GMT
Keep-Alive: timeout=5, max=99
Last-Modified: Mon, 24 Feb 2014 02:17:21 GMT
Server: Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9
X-Powered-By: PHP/5.5.9

i think this is happening because of the url format, you can use apache's mod_rewrite to make a url format for images given by this script to look like localhost/image/123.png 我认为这是因为url格式,你可以使用apache的mod_rewrite为这个脚本给出的图像制作一个url格式,看起来像localhost/image/123.png

EDIT 编辑

after reading your comment, i can say that it's not about your server's config, you can't do anything about it according to this and this because of HTTPS implementations since you have Cache-control: public set already. 读您的评论后,我可以说,这是不是你的服务器的配置,你不能根据任何关于它这个这个 ,因为HTTPS实现的,因为你有Cache-control: public组了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM