和标题一样,查出这项有问题。
更详细的问题描述:
使用浏览器缓存
在 HTTP 标头中为静态资源设置过期日期或最长存在时间,可指示浏览器从本地磁盘中加载以前下载的资源,而不是通过网络加载。
看了它给的优化建议,全部都是英文的,看不明白。内容如下:
引用 Leverage Browser Caching
This rule triggers when PageSpeed Insights detects that the response from your server doesn’t include explicit caching headers or if the resources have a short freshness lifetime.
Overview
Browser caching for static resources can save a user time if they visit your site more than once. Caching headers should apply to all cacheable static resources, not just a small subset (such as images). Cacheable resources include JS and CSS files, image files, and other binary object files (media files, PDFs, etc.). In general, HTML is not static and shouldn't be considered cacheable by default. You should consider what caching policy would work well for your site’s HTML.
Recommendations
Enable browser caching for your server. Static resources should have a cache lifetime of at least a week. For third-party resources like ads or widgets, they should have a cache lifetime of at least one day. For all cacheable resources, we recommend the following settings:
Set Expires to a minimum of one week, and preferably up to one year, in the future. (We prefer Expires over Cache-Control: max-age because it is is more widely supported.) Do not set it to more than one year in the future, as that violates the RFC guidelines.
If you know exactly when a resource is going to change, setting a shorter expiration is okay. But if you think it "might change soon" but don't know when, you should set a long expiration and use URL fingerprinting (described below).
Expires and Cache-Control: max-age headers
These specify the time period during which the browser can use the cached resource without checking to see if a new version is available from the web server. They are "strong caching headers" that apply unconditionally. Once they're set and the resource is downloaded, the browser will not issue any GET requests for the resource until the expiry date or maximum age is reached or the cache is cleared by the user.
Last-Modifed and ETag headers
These specify how the browser should determine if the files are the same for the purposes of caching. In the Last-Modified header, this is a date. In the ETag header, this can be any value that uniquely identifies a resource (file versions or content hashes are typical). Last-Modified is a "weak" caching header in that the browser applies a heuristic to determine whether to fetch the item from cache or not.
These headers allow the browser to efficiently update its cached resources by issuing conditional GET requests when the user explicitly reloads the page. Conditional GETs don't return the full response unless the resource has changed at the server, and thus have lower latency than full GETs.
Which caching headers should I use?
我的服务器是windows2008+iis7.5的
请问要怎么设置这个 【Last-Modifed and ETag】标头啊?求详细步骤。