enable GZIP compression [closed]

2019-01-27 06:12发布

I am trying to find out any api to enable GZIP compression in html pages. Any other smart solution for GZIP compression, please help me out.

Thanks a lot

标签: gzip
2条回答
唯我独甜
2楼-- · 2019-01-27 06:50

If you are using tomcat then you can use tomcat inbuilt feature to do gzip compression. add comression = "on" in server.xml [most of the server have compression support. check for server configuration for a differentI server]

<Connector port="8443"
      compression="on"
      compressionMinSize="2048"
      noCompressionUserAgents=""
      compressableMimeType="text/html,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json"
    /> 

For chrome it will directly show in developers tool under network profiling the size getting reduced. I you are using mozilla use firebug network profiler to see actually the size of your file getting reduced and to cross check click on the link to see the request and response header having:

Content-Encoding: gzip

查看更多
登录 后发表回答