1

Yes, I've read Alan Storm's suggestion, but I can't really call it a solution. My Gzip compression is configured correctly, only the merged css and js files aren't compressing (according to Google PageSpeed Insights). Does anyone have a solution?

The linked suggestion also notes that you should configure Gzip for the media/css and media/js folder too. I don't really understand this, because those files seem nowhere excluded from the global Gzip htaccess rule (Magento rule which is commented by default.)


edit: additional information:

Gzip

gzip compression => enabled

Zlib

zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

.htaccess

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter on all content
###SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

# 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

</IfModule>

Response headers merged JS file 1 (Magento core JS)

Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 547528
Content-Type: application/javascript
Date: Fri, 10 Jul 2015 09:51:35 GMT
Etag: "23f7c0-85ac8-51a6e0082dfbb"
Keep-Alive: timeout=1, max=100
Last-Modified: Thu, 09 Jul 2015 09:37:20 GMT
Server: Apache
Vary: User-Agent

Response headers merged JS file 2 (skin JS)

Connection: Keep-Alive
Date: Fri, 10 Jul 2015 09:53:04 GMT
Etag: "23f7c4-2ef94-51a6e00835cbb"
Keep-Alive: timeout=1, max=99
Server: Apache
Vary: User-Agent
2
  • What does your browser say for the return headers for these files? Does it show gzip compression? What .htaccess rules are you using for compression? is zlib compression enabled in php? Are you using mod_pagespeed? If so, did you flush its cache? Commented Jul 9, 2015 at 23:52
  • @RobMangiafico I've edited my question. Does zlib need to be enabled? I'm not using mod_pagespeed. Should I ?
    – Frank
    Commented Jul 10, 2015 at 9:54

1 Answer 1

1

Change this .htaccess line:

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

to:

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript text/x-js application/x-javascript application/javascript

and it should compress the merged js/css files. If you look at the "Content-type:" line in your headers, it shows:

Content-Type: application/javascript

which does not match the generic AddOutputFilterByType.

1
  • Indeed, changing that line does the trick. Weird that Magento didn't implemented this by themselves. After all, they also provide the merging functionality. Anyways, thanks!
    – Frank
    Commented Jul 10, 2015 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.