15

@tools.pingdom.com I get a warning in leverage cache-control because of these resources:

http://code.jquery.com/jquery-1.6.2.min.js
http://www.google-analytics.com/ga.js
http://edge.sharethis.com/images/spinner.gif
http://w.sharethis.com/button/buttons.js

Which are not in my host.

What can I do about this?

This is the beginning of my htaccess:

# 480 weeks
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

# 1 weeks
<FilesMatch "\.(js)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

3 Answers 3

21

You can't control the headers sent from a server that you don't control.

In other words, either host a copy yourself or there's nothing you can do about it.

1
  • 2
    jquery ok because i know the versión. but what about analytics and sharethis, what if they update their versions? Mar 6, 2012 at 15:46
4

You can grab the code from the resources and serve them from your site directly, in these way you can manage the cache, but if some update occurs from the sites related to the resources, you miss it, or you have to control everytime ..chose at your convenience.

1
  • 5
    But probably it's not a good Idea to cache the google analytics script, right? it's probably dynamic.. Sep 21, 2013 at 8:12
1

You can try copy their scripts and host them youself. Just write a script and add it to cron to load new versions automaticly. Working on it now myself.

1
  • I tried this, but they contain relative urls to resources of respective servers, i only worked for twitter for me.. Jul 28, 2015 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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