0
我裝飾了Django視圖與cache_control
如下:Django緩存控制標題:Chrome爲什麼不緩存此資源?
@cache_control(
private=True,
max_age=5 * 60, # 5 minutes
)
def my_view(req):
…
當我在本地測試服務器嘗試它,它按預期工作:在Chrome隨後的頁面訪問量使用緩存的資源,不作請求。但是,在生產環境中進行部署時,Chrome似乎忽略Cache-control
標題,並在每次點擊該頁面時發出新請求。
這裏是一個生產服務器響應報頭的完整列表:
Cache-Control:private, max-age=300
Connection:close
Content-Encoding:gzip
Content-Length:13135
Content-Type:text/html; charset=utf-8
Date:Wed, 22 Jan 2014 20:39:29 GMT
P3P:CP="IDC CURa ADMa OUR IND PHY ONL COM STA"
Server:nginx/1.4.1
Set-Cookie:csrftoken=87y26bT5uPmyA9wt51N7m4blyqBH5nSo; expires=Wed, 21-Jan-2015 20:39:29 GMT; Max-Age=31449600; Path=/
Vary:Cookie,Accept-Encoding
可能是什麼回事?有任何想法嗎?提前致謝!