简体   繁体   中英

set cache-control to external resources?

@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>

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.

您可以从资源中获取代码并直接从您的站点提供这些代码,这样您就可以管理缓存,但如果从与资源相关的站点进行某些更新,您会错过它,或者您必须每次都进行控制。选择在你方便。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM