Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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