我们有JSF Web应用程序,它生成XLS文件并为用户提供指向该文件的链接 如果通过HTTP访问此文件,一切正常 但IE(8)无法通过HTTPS打开/保存此xls文件 有以下错误消息:
Internet Explorer cannot download ...466088C5C313F92808BDB0AFF3447 from testhost.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
我可以在Firefox和Chrome中通过HTTPS打开同一个文档 IE可能有什么问题?
标题:
HTTP/1.1 200 OK
Date: Fri, 18 Jun 2010 14:45:42 GMT
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
X-UA-Compatible: IE=EmulateIE7
Last-Modified: Fri, 18 Jun 2010 14:45:11 GMT
Cache-control: max-age=0, no-store, no-cache
Pragma: no-cache
Expires: 0
Content-Type: application/vnd.ms-excel
Content-Length: 6656
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
答案 0 :(得分:12)
根据http://support.microsoft.com/kb/316431,您应该删除您使用的任何HTTP标头:
Pragma: no-cache
Cache-control: no-cache,max-age=0,must-revalidate
答案 1 :(得分:6)
最可能的原因是http响应标头,我们必须专门为ssl下的xls文件配置
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Fri, 18 Jun 2010 16:22:07 GMT
Cache-Control: cache, must-revalidate
Pragma: public
用于缓存控制 和
Content-Type: application/vnd.ms-excel
Content-Disposition: attachment; filename="ExcelDownload.xls"
Content-Transfer-Encoding: binary
Content-Length: <fileSize>
的内容
关键条目是Pragma:public
答案 2 :(得分:1)
您是否将缓存控制设置为无缓存?我遇到了类似的问题。有关详细信息,请参阅this question and answer。