虽然这个问题应该是微不足道的,但我没有成功在web google app engine java server上启用浏览器缓存.
我试着把这种东西放在我的appengine-web.xml中:
<static-files>
<include path="/**.cache.**" expiration="365d" />
...
Run Code Online (Sandbox Code Playgroud)
但当我看到响应标题时,我在本地发现了这个:
Content-Length: 196084
Cache-Control: public, max-age=31536000
Expires: Fri, 10 Jan 2014 19:40:45 GMT
Content-Type: image/png
Last-Modified: Tue, 18 Dec 2012 21:41:22 GMT
Server: Jetty(6.1.x)
Run Code Online (Sandbox Code Playgroud)
哪个好......但是在生产环境中这个:
HTTP/1.1 304 Not Modified
ETag: "RV4Bpg"
X-AppEngine-Estimated-CPM-US-Dollars: $0.000000
X-AppEngine-Resource-Usage: ms=109 cpu_ms=0
Date: Thu, 10 Jan 2013 19:41:20 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Server: Google Frontend
Run Code Online (Sandbox Code Playgroud)
这绝对不是我想要的:(
任何的想法 ?我错过了什么?
[编辑] 尚未下载的内容,我的浏览器收到以下标题:
HTTP/1.1 200 OK
ETag: "RV4Bpg"
Date: Fri, 11 Jan 2013 12:50:50 GMT
Expires: Sat, 11 Jan 2014 12:50:50 GMT
Cache-Control: public, max-age=31536000
X-AppEngine-Estimated-CPM-US-Dollars: $0.000000
X-AppEngine-Resource-Usage: ms=3 cpu_ms=0
Date: Fri, 11 Jan 2013 12:50:50 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Content-Type: image/png
Server: Google Frontend
Content-Length: 196084
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
X-RBT-Optimized-By: eu-dcc-sh02 (RiOS 6.5.5b) SC
Run Code Online (Sandbox Code Playgroud)
一个ETag和几个相互矛盾的"Expires"和"Cache-Control"......有几种配置缓存策略的方法吗?它可以来自我的ISP吗?还是代理?
当您以管理员身份登录Google App Engine应用程序时:
X-AppEngine-*您的问题中显示的标题包含在内.Cache-Control: no-cache, must-revalidate头被包含,因为X-AppEngine-*头是私有的,必须不被缓存.这隐藏在https://developers.google.com/appengine/docs/python/runtime#Responses的"回复"部分的末尾,其中说明:
资源使用统计信息的响应将不可缓存.
| 归档时间: |
|
| 查看次数: |
3403 次 |
| 最近记录: |