yslow still not giving me an A for expires header in apache httpd even though I added them

浪子不回头ぞ 提交于 2020-01-03 05:53:09

问题


trying to add an ExpiresDefault ExpiresByType to content on my website so that way it is cached. I use cachebusting in the URL (a revision number in the path) for Javascript, CSS, and images so that way I can set it to forever for these mimetypes. I have the following rules set up in apache httpd:

  ExpiresActive On
  ExpiresDefault "access plus 1 minutes"
  ExpiresByType image/gif "access plus 10 years"
  ExpiresByType image/png "access plus 10 years"
  ExpiresByType image/jpeg "access plus 10 years"
  ExpiresByType image/jpg "access plus 10 years"
  ExpiresByType text/javascript "access plus 10 years"
  ExpiresByType text/css "access plus 10 years"

Then when I go to my website http://karmerd.com and use httplive headers to look at the headers I get what I think should be the correct Expires for css: Expires: Sun, 03 Feb 2019 17:52:48 GMT

But I use Yahoo's Yslow firebug extension and it's still giving me an F for not using Expires! Am I doing something wrong? I'm also using gravatars on my site, but they have Expires set. Seems like everything has an expires. Is it Yslow or me?


回答1:


Your javascript files are being sent out as application/x-javascript, so aren't getting a far-future Expires header.




回答2:


Don't rely on that tool to judge if your site is running fast or not. I've had it do many quirky things (just like yui) - and if it is giving you a false positive, your site is running fine, and you have no one complaining about speed - you most likely do not have a speed issue. The best way to see if things are cacheing are to watch the requests in firebug or another tool as they go out, if you aren't requesting it and retrieving it then it hasn't expired.



来源:https://stackoverflow.com/questions/517083/yslow-still-not-giving-me-an-a-for-expires-header-in-apache-httpd-even-though-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!