雖然這個問題應該是微不足道的,但我沒有成功在Web應用程序引擎Java服務器上啓用瀏覽器緩存。如何在GAE中啓用瀏覽器緩存
我試圖把這種事情在我的AppEngine-web.xml中:
<static-files>
<include path="/**.cache.**" expiration="365d" />
...
,但是當我在尋找的響應頭,我覺得這個地方:
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)
這很好......但是這在生產環境中:
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
這是明確不是我想要:(
任何想法?我錯過了什麼?
[編輯] 對於還沒有下載的內容,我的瀏覽器收到以下標題:
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
一個ETag和幾個矛盾「過期」和「緩存控制」 ...... 有幾種配置緩存策略的方法?它能來自我的ISP嗎?或代理?
在App Engine上的Servlet響應中可能重寫了[與高速緩存相關的HTTP標頭](http://stackoverflow.com/questions/14172758/cache-related-http-headers-are-overridden-in- servlet-response-on-app-engine) – icza