Enable mod_deflate to send Content-Encoding: gzip

EDIT I found that the problem is actually php minify . This sent deflated content instead of Apache. I will find more about it.

According to High Performance Websites , if I enable mod_deflate in Apache 2.x by adding the following line, it should send gzipped / delfated content: -

AddOutputFilterByType DEFLATE text/html text/css application/x-javascript 

The book also says gzip more efficient than deflate .

I included in httpd.conf by adding the same line. But Apache does send Content-Encoding: deflate .

I tested CURL using: -

 curl -i -H "Accept-Encoding: gzip" "http://192.168.1.33/s.js" >> e:\curl_log.txt 

It returns the contents of "gzipped". But when I send the command: -

 curl -i -H "Accept-Encoding: gzip, deflate" "http://192.168.1.33/s.js" >> e:\curl_log.txt 

It returns "sleeping" content.

So, if the browser supports both sleep and gzipped, Apache send deflated. How to tell Apache that he prefers gzip for deflation?

FYI: -

+6
apache deflate mod-deflate
source share
3 answers

As I see it, the reason has already been found. To help deal with potential confusion:

  • mod_deflate, although his name currently only supports gzip.

  • gzip is more "efficient" due to the following

deflate - despite its name, zlib compression (RFC 1950) (in combination with deflation compression (RFC 1951)) should be used, as described in RFC 2616. However, the real world implementation changes between zlib compression and (raw) deflate compression [3 ] [4]. Because of this confusion, gzip is positioning itself as a more robust default method (March 2011).

gzip and zlib are file / stream formats that by default wrap deflation and, among other things, add a checksum that makes them more secure and a bit slower. On the other hand, the increase in size should not be a concern.

Also see HTTP_compression - Wikipedia

+2
source share

See http://httpd.apache.org/docs/2.0/mod/mod_deflate.html for all gory details - are you sure you don't have no-gzip occurrences elsewhere in the configuration? What happens when you change your β€œbrowser”, for example. using wget with different values ​​for -U ?

0
source share

I suspect that everything you use for testing does not send ...

Accept-Encoding: gzip

... in the request header.

0
source share

All Articles