Extension, Plugin

Archived
Forum
(read-only)

Minimee

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From John D. Wells

     

Minimeed files missing a cache validator

General

Tyssen
Tyssen

When I run my site through Google PageSpeed, I get a warning that my minimeed files:

are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources

Another test shows that the files have an expiry of 30 minutes whereas my .htaccess (via HTML5 Boilerplate) is set up to not expire CSS or js files for a year.

So I’m guessing the Minimeed files are sending their own expires headers that override this. Is that what’s happening?

John D Wells
# 1
Developer
John D Wells

Hi John,

Minimee doesn’t send any of its own headers, all it does is save the files to your server, and your server is what’s serving the files to the browser.  Is there an htaccess file within the subfolder of Minimee’s cache directory that perhaps specifies a different expiry?

Cheers,
John

Tyssen
# 2
Tyssen

No, no .htaccess file in my cache folder.

I’ve actually fixed part of the problem. I was including a CDN-hosted version of jQuery in my minified file. Moving jQuery out of the Minimee tags removes the minified js file from being flagged; instead it flags jQuery as not having a cache validator, although the overall score goes up by 2 points (currently at 97) with this method.

It’s still flagging the CSS as being a problem though. :?

John D Wells
# 3
Developer
John D Wells

You’ve managed to get to 97 points?!?!? Which ruleset are you going by?  That’s incredible.

Try disabling Minimee and just using the original CSS, I think you’ll find that the headers are the same - Minimee doesn’t “serve” anything to the browser, it simply creates static files. And unless I’m missing something, there’s nothing I can do when creating a file to specify what sort of headers the server should send.

But like I said, try linking to your own CSS, being sure to use the same domain, and you should find you’ll get the same expires headers.  Maybe the detection is inaccurate? Or your host isn’t allowing you to change them?

Cheers,
John

Tyssen
# 4
Tyssen
John D Wells - 20 March 2013 11:20 AM

You’ve managed to get to 97 points?!?!? Which ruleset are you going by?  That’s incredible.

There’s no ruleset for PageSpeed, I just input the URL into https://developers.google.com/speed/pagespeed/insights

If I do a test with YSlow using YSlow(V2) I get an 86, but interestingly it doesn’t flag the CSS as having incorrect expires headers.

John D Wells - 20 March 2013 11:20 AM

Try disabling Minimee and just using the original CSS, I think you’ll find that the headers are the same

You’re right, both minified and normal versions of the CSS get flagged for the same thing, even though I’ve got

ExpiresByType text/css  "access plus 1 year"
ExpiresByType application/javascript  "access plus 1 year" 

in my .htaccess.

The difference in how YSlow and PageSpeed interpret the headers of the CSS is a bit perplexing. :?

John D Wells
# 5
Developer
John D Wells

Hi John,

Yeah YSlow is a stickler - still that’s a pretty good score, well done.

I’m not sure why they’d be interpreting headers differently - to be honest I’ve seen that sort of behaviour before, and had always just assumed I was doing something wrong, so it’s nice to hear it may not be just me!  But sorry, I’m no htaccess expert so can’t really help you get to the bottom of this one.  Please do share though if you figure out what was up…

Cheers,
John