5
我的application.js文件名看起來像application-b600352536291bc180983d43e6a2407f.js
。所以它的名字裏有md5緩存。我已將靜態資產的最大期限選項設置爲1小時config.static_cache_control = "public, max-age=3600"
。但我注意到,瀏覽器不尊重max-age
標題,並始終從服務器重新驗證,並執行304 Not Modified
的往返。我怎樣才能保存往返?heroku上的鏈輪max-age header
請求頭
Request URL:https://blah.com/assets/application-b600352536291bc180983d43e6a2407f.js
Request Method:GET
Status Code:304 Not Modified
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
If-Modified-Since:Sun, 12 Feb 2012 07:36:16 GMT
響應頭
Cache-Control:public, max-age=3600
Connection:keep-alive
Date:Sun, 12 Feb 2012 18:27:48 GMT
Last-Modified:Sun, 12 Feb 2012 07:36:16 GMT
Server:nginx
Vary:Accept-Encoding
Via:1.1 varnish
X-Varnish:499878183
你使用什麼瀏覽器?我對Chrome有着類似的體驗,它總是發送'Cache-Control:max-age = 0' – 2012-06-21 00:49:54