: Minify not caching according to pagespeed insights I started using https://code.google.com/p/minify/ on my site to decrease the amount of http requests. But google's PageSpeed insights tool is telling
I started using code.google.com/p/minify/ on my site to decrease the amount of http requests. But google's PageSpeed insights tool is telling me that the new reference link isn't being cached. A example of one of the new links that Minify created is this one:
<link type="text/css" rel="stylesheet" href="/min/f=css/responsee.css,css/components.css,css/animate.css,owl-carousel/owl.theme.css,owl-carousel/owl.carousel.css" />
My htaccess file has caching setup just fine and before I combined the .css files everything was being cached according to Pagespeed. Is this a bug or do I have to add a new line to my htaccess file?
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rdf+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/ld+json "access plus 0 seconds"
ExpiresByType application/schema+json "access plus 0 seconds"
ExpiresByType application/vnd.geo+json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!) and cursor images
ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
# HTML
ExpiresByType text/html "access plus 0 seconds"
# JavaScript
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
# Manifest files
ExpiresByType application/manifest+json "access plus 1 year"
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Media files
ExpiresByType audio/ogg "access plus 1 week"
ExpiresByType image/bmp "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/svg+xml "access plus 1 week"
ExpiresByType image/webp "access plus 1 week"
ExpiresByType video/mp4 "access plus 1 week"
ExpiresByType video/ogg "access plus 1 week"
ExpiresByType video/webm "access plus 1 week"
# Web fonts
# Embedded OpenType (EOT)
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType font/eot "access plus 1 month"
# OpenType
ExpiresByType font/opentype "access plus 1 month"
# TrueType
ExpiresByType application/x-font-ttf "access plus 1 month"
# Web Open Font Format (WOFF) 1.0
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
# Web Open Font Format (WOFF) 2.0
ExpiresByType application/font-woff2 "access plus 1 month"
# Other
ExpiresByType text/x-cross-domain-policy "access plus 1 week"
</IfModule>
EDIT:
Here is the header:
GET /min/f=css/responsee.css,css/components.css,css/animate.css,owl-carousel/owl.theme.css,owl-carousel/owl.carousel.css HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: example.com/ Cookie: PHPSESSID= -removed-;
sc_is_visitor_unique=rx10296953.1429464775.24A3E18F98904F802719FEC9140DFAFF.30.22.19.17.10.6.3.1.1
Connection: keep-alive
If-Modified-Since: Sun, 19 Apr 2015 15:43:07 GMT
If-None-Match: "pub1429458187;gz"
Cache-Control: max-age=0
HTTP/1.1 304 Not Modified
Date: Sun, 19 Apr 2015 17:34:10 GMT
Server: Apache
Connection: Keep-Alive
Keep-Alive: timeout=15, max=99
Etag: "pub1429458187;gz"
Expires: Sun, 19 Apr 2015 18:04:10 GMT
Cache-Control: max-age=1800
Vary: Accept-Encoding,User-Agent
More posts by @Sims2060225
1 Comments
Sorted by latest first Latest Oldest Best
You can see from the response headers (after the edit): "304 Not Modified" - this indicates that the resource is being cached by the browser after all (which is also probably why there is no Content-Type header in this particular response).
However, this resource is "only" being cached for 30 minutes, which might be why the PageSpeed tool is complaining?
The Cache-Control: max-age=1800 header is telling the browser to cache this response for 30 minutes (and this matches the Expires header when compared with the timestamp of the request).
I would assume the Cache-Control headers are being set by the Minify script - which will override mod_expires (which will only set the header if it doesn't already exist).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.