在有人指出之前,是的,我通过SFO挖掘并阅读所有链接/解决方案,但我仍然无法找到问题。这就是我创建这个新帖子的原因。
所以,我使用Spring 4 + AngularJS和Tomcat 7.0.67。尝试压缩HTTP响应,因为大多数时候它都是大约200 KB的JSON数据!所以我创建了一个压缩响应的过滤器,除了IE9之外,所有浏览器都能正常工作!你可能会问为什么IE9?因为我的客户这么说!所以我别无选择。
我尝试在Controller中添加Content-Encoding,如
response.setHeader("Content-Encoding", "gzip, deflate");
但IE无法解密数据,尽管数据像其他浏览器一样被压缩!
我甚至为所有请求添加了以下行,
$httpProvider.defaults.headers.common["Accept-Encoding"] = "gzip, deflate";
但仍无效。
请帮我理解是什么问题!
更新 其他浏览器中的gzipped响应大小为14.7KB,但在IE中为225KB,这是未压缩的数据大小!
**详细标题:**
Response Headers :
view source
Cache-Control:public, max-age=0, must-revalidate
Content-Encoding:gzip
Content-Length:14624
Content-Type:application/json;charset=UTF-8
Date:Mon, 18 Jan 2016 11:48:03 GMT
Expires:Mon, 18 Jan 2016 11:48:02 GMT
Server:Apache-Coyote/1.1
Request Headers :
view source
Accept:application/json, text/html
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Content-Length:0
Cookie:JSESSIONID=83DCA3B424E9F7A3EB8E165EFDA9730D; __ngDebug=true
Host:localhost:8080
Origin:http://localhost:8080
Pragma:no-cache
Referer:http://localhost:8080/AppName/test/
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
来自IE9的标题
Request POST http://xx.xx.xx.xx:8080/AppName/loadClientMaster HTTP/1.1
Referer http://xx.xx.xx.xx:8080/AppName/test/#/menu
Accept application/json, text/html
Accept-Language en-us
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host xx.xx.xx.xx:8080
Content-Length 0
Proxy-Connection Keep-Alive
Pragma no-cache
Cookie JSESSIONID=9FBA9758381235CD22974C796449747B
Response HTTP/1.1 200 OK
Server Apache-Coyote/1.1
Cache-Control public, max-age=0, must-revalidate
Expires Mon, 18 Jan 2016 12:10:03 GMT
Content-Type application/json;charset=UTF-8
Date Mon, 18 Jan 2016 12:10:04 GMT
X-Cache MISS from PROXYNEW
X-Cache-Lookup MISS from PROXYNEW:8080
Via 1.1 PROXYNEW (squid/3.2.3)
Connection keep-alive