1

I am running Debian squeeze and cannot get Apache to compress JavaScript or CSS. HTML, however, is being compressed. In the conf files in the sites-enabled dir, I've got the following:

<Location />
  <IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    <IfModule mod_headers.c>
      Header append Vary User-Agent env=!dont-vary
    </IfModule>
  </IfModule>
</Location>

Any insights into why JS/CSS aren't being compressed?

Edit:

Request headers for CSS = Accept:text/css,/;q=0.1,
Response headers for CSS = Content-Type:text/css

1 Answer 1

1

I've never had much luck when specifying compression based on mime type. I've had better luck using FilesMatch instead like:

<FilesMatch "\.(html|js|css)$">
    SetOutputFilter DEFLATE
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent env=!dont-vary
</FilesMatch>

As this question has been opened for a while though, I'm curious what you did to fix.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .