Álv*_*lez 17 php apache caching http
如果我使用Google Chrome在我的网站上运行审核,我会在Leverage浏览器缓存部分中收到此消息:
以下资源缺少缓存过期.浏览器可能不会缓存未指定过期的资源:
下面列出了所有图片.我在Leverage代理缓存中得到类似的通知:
考虑在以下资源中添加"Cache-Control:public"标头:
除了图片,我还会收到有关HTML,CSS和JavaScript文件的通知:
以下资源显式不可缓存.如果可能,请考虑使它们可缓存:
它很有趣,因为我努力缓存所有静态内容(除了图片,我刚刚离开Apache的默认设置).Firefox确实将所有这些项存储在缓存中.
我的HTTP标头中有什么要改进的吗?
这是删除浏览器caché后加载的一些项目的完整标题集.图片使用我以前没有真正检查的默认设置,其余的应该是cachéd三个小时.我可以用.htaccess
和设置标题PHP
.
HTTP/1.1 200 OK
Date: Sat, 31 Jul 2010 12:46:14 GMT
Server: Apache
Last-Modified: Thu, 18 Mar 2010 21:40:54 GMT
Etag: "c48024-230-4821a15d6c580"
Accept-Ranges: bytes
Content-Length: 560
Keep-Alive: timeout=4
Connection: Keep-Alive
Content-Type: image/png
Run Code Online (Sandbox Code Playgroud)
HTTP/1.1 200 OK
Date: Sat, 31 Jul 2010 12:46:13 GMT
Server: Apache
X-Powered-By: PHP/5.2.11
Expires: Sat, 31 Jul 2010 15:46:13 GMT
Cache-Control: max-age=10800, s-maxage=10800, must-revalidate, proxy-revalidate
Content-Encoding: gzip
Vary: Accept-Encoding
Last-Modified: Wed, 24 Mar 2010 20:30:36 GMT
Keep-Alive: timeout=4
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-15
Run Code Online (Sandbox Code Playgroud)
HTTP/1.1 200 OK
Date: Sat, 31 Jul 2010 12:48:21 GMT
Server: Apache
X-Powered-By: PHP/5.2.11
Expires: Sat, 31 Jul 2010 15:48:21 GMT
Cache-Control: max-age=10800, s-maxage=10800, must-revalidate, proxy-revalidate
Content-Encoding: gzip
Vary: Accept-Encoding
Last-Modified: Thu, 18 Mar 2010 21:40:12 GMT
Keep-Alive: timeout=4
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/css
Run Code Online (Sandbox Code Playgroud)
HTTP/1.1 200 OK
Date: Sat, 31 Jul 2010 12:48:21 GMT
Server: Apache
X-Powered-By: PHP/5.2.11
Expires: Sat, 31 Jul 2010 15:48:21 GMT
Cache-Control: max-age=10800, s-maxage=10800, must-revalidate, proxy-revalidate
Content-Encoding: gzip
Vary: Accept-Encoding
Last-Modified: Thu, 18 Mar 2010 21:40:12 GMT
Keep-Alive: timeout=4
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/x-javascript
Run Code Online (Sandbox Code Playgroud)
我测试了Jumby的建议并将我的CSS过期设置为1年:
Cache-Control:max-age=31536000, s-maxage=31536000, must-revalidate, proxy-revalidate
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:4198
Content-Type:text/css
Date:Mon, 02 Aug 2010 20:48:56 GMT
Expires:Tue, 02 Aug 2011 20:48:56 GMT
Keep-Alive:timeout=5, max=99
Last-Modified:Thu, 18 Mar 2010 20:40:12 GMT
Server:Apache/2.2.14 (Win32) PHP/5.3.1
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.1
Run Code Online (Sandbox Code Playgroud)
但是,Chrome仍声称" 明确不可缓存 ".
归档时间: |
|
查看次数: |
8330 次 |
最近记录: |