我有一个网站,并且在所有页面/图像和脚本上添加了过期标题,但我不知道如何将过期标题添加到外部脚本。
例如Google Analytics(分析) - 它已将过期的标题设为1天。
Google不是我的问题,外部网站的其他脚本是真正的问题,它们根本没有过期头文件。
解决方案您只能添加标题字段,以响应发送到您自己的服务器的请求。如果请求发送到另一台服务器,比如说Google的服务器,那么它的响应速度就会比Google服务器的响应速度快。
因此,解决您的问题的唯一方法就是将您的外部资源托管在您的拥有服务器。但是这只有在资源是静态的时候才可能发生,不要求从请求到请求,也不要依赖于其他东西。
I have a website and I added the expire headers on all pages/images and scripts but I don’t know how I could add expire headers to external scripts.
For example Google Analytics - it has expire headers set to 1 day.
Google is not my problem, some other scripts from external websites are the real problem, they don't have expire headers at all.
解决方案You can only add header fields in responses to requests that go to your own server. If the request goes to another server, say Google’s server, than it’s Google’s server that answers the request.
So the only solution to your problem is hosting that external resources on your own server. But that’s only possible if that resources are static, do not change from request to request and do not depend on other things.
更多推荐
我如何为不在服务器上的脚本添加过期头文件?
发布评论