enable GZIP compression [closed]

2019-01-27 06:10发布

问题:

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

回答1:

For IIS 6: Using HTTP Compression for Faster Downloads (IIS 6.0)

For IIS 7: Enable IIS7 gzip

For Apache: Apache2 gzip compression



回答2:

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



标签: gzip