Reset / compress javascript and css files

After adding this virtual host for the domain

AddOutputFilterByType DEFLATE application/javascript text/javascript text/css

The response header does not contain content like: gzip or deflate

This is the response header for the CSS file.

Cache-Control max-age=29030400
Connection Keep-Alive
Date Sat, 06 Jun 2015 10:15:35 GMT
Etag "f0007e-46364-514a70ecd9000"
Expires Sat, 07 May 2016 10:15:35 GMT
Keep-Alive timeout=5, max=97
Server Apache
Vary Accept-Encoding
+4
source share
3 answers

try it

AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/css

and remember to clear the cache before reloading the page.

0
source

Connect your browser to Fiddler and see what happens. CSS files can be cached in your browser, in which case it will be downloaded from the browser cache after checking the expiration date. You should see answers with a status of 304. Clear your browser’s cache and try again.

Also make sure your VH configuration looks something like

<VirtualHost *:PORT>
    LoadModule deflate_module "<SO_LOCATION>/mod_deflate.so"
    <IfModule deflate_module>
            AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript text/css application/javascript text/j-son text/javascript
    </IfModule>
</VirtualHost>
0
source

Apache 2.4, : http://httpd.apache.org/docs/2.4/mod/mod_deflate.html

, httpd.conf mod_deflate.

What you want to use is the first sample configuration in the document (adding / removing mime types for your own requirements):

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

0
source

All Articles