Monday, January 26, 2015

Heroku: enable gzip compression

Add to your .htaccess file:

##################### GZIP COMPRESSION #####################

SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-phpBrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
Header append Vary User-Agent env=!dont-vary

Reference:
http://stackoverflow.com/questions/12367858/how-can-i-get-apache-gzip-compression-to-work

No comments: