我试图通过将以下更改压缩到standalone.xml中来压缩Http响应:
<system-properties>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION" value="on"/>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" value="text/javascript,text/css,text/html,application/json"/>
</system-properties>但这个解决方案没有奏效。我还在请求中传递了"Accept-Encoding:gzip,deflate“报头,当我使用fiddler截获来自服务器的http响应时,它没有被压缩。
请帮帮我!
发布于 2015-01-08 17:31:02
不要修改standalone.xml文件,尝试编辑standalone.conf文件并添加以下行:
如果您在unix/linux/macos上,可以使用curl验证:
curl --raw -i -H "Accept-Encoding: \"gzip,deflate\"" -v http://localhost:8020/sarpsa/检查服务器返回text/javascript、text/css或text/html的响应:
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=3M16ifxp2tkkrtoc9ZcKTOCr; Path=/application
Content-Type: text/html;charset=iso-8859-1
Transfer-Encoding: chunked
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Thu, 08 Jan 2015 17:28:34 GMT否则,如果您正在获取其他内容类型,请将其添加到COMPRESSION_MIME_TYPES列表中
https://stackoverflow.com/questions/27550163
复制相似问题