What is deflate: deflate is apache module, that main task is to compress all the output before serving or sending to browser.

How browser  handle this compression : Most of the browser are very much expert ,so they can handle this easily . The main technique is , apache will send the output in compressed format, after receiving this output  browser will uncompress it and render the formated output.

How to enable: 1. Open a new terminal and give this command.
2. sudo a2enmod deflate

3. create new file called deflate.conf in your apache conf.d folder. and paste the following code:

 <Location />

# Insert filter
 SetOutputFilter DEFLATE

# Netscape 4.x has some problems…
 BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
 BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 # Don’t compress images
 SetEnvIfNoCase Request_URI \
 \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content
 Header append Vary User-Agent env=!dont-vary

</Location>

save the file.

4. sudo /etc/init.d/apache2 restart

Note: Please check your apache module,if you have not enabled header module of apache,

you must remove the line “Header append Vary User-Agent env=!dont-vary” from deflate.conf .

Advertisement