0

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

Sanket
  • 659
  • 3
  • 10
  • 24
  • 3
    In which context ? gzip compression is usually a setting on the web server, or possibly an API call in an web server you'd embed in your program. – nos Feb 09 '11 at 20:07

2 Answers2

6

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

For IIS 7: Enable IIS7 gzip

For Apache: Apache2 gzip compression

Community
  • 1
  • 1
RichardTheKiwi
  • 105,798
  • 26
  • 196
  • 262
  • 1
    It might be worth noting that from the client's side, if you want to verify that the file is indeed compressed, you'll need to use the appropriate http request header. Using "wget" to request the file, for example, would look like the following: `wget --header="accept-encoding: gzip" "http://www.mytestsite.com"` – PixelCloudSt Nov 19 '11 at 03:34
0

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

Arun Pratap Singh
  • 3,428
  • 30
  • 23