2013-10-11 21 views
0

這裏是請求頭:Firefox重新加載緩存的PHP腳本。如何防止這種行爲?

GET /url/ HTTP/1.1 
Host: example.com 
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3 
Accept-Encoding: gzip, deflate 
DNT: 1 
Cookie: data=ABC; 
Connection: keep-alive 
Cache-Control: max-age=0 

這裏是來自服務器的響應:

HTTP/1.1 200 OK 
Date: Fri, 11 Oct 2013 23:28:32 GMT 
Server: Apache/2.2.14 (Ubuntu) 
X-Powered-By: PHP/5.3.2-1ubuntu4.18 
Expires: Wed, 16 Oct 2013 03:28:32 GMT 
Cache-Control: max-age=360000 
Pragma: cache 
Content-Language: en 
Vary: Accept-Encoding 
Content-Encoding: gzip 
Content-Length: 844 
Keep-Alive: timeout=15, max=92 
Connection: Keep-Alive 

無論多少次,我刷新頁面,不管如何,它總是讓一個請求(由於它是HTTPS,因此需要200ms以上)。我在監督什麼?響應頭文件是否包含更多參數以防止Firefox發出服務器請求?

+0

http://stackoverflow.com/a/385491/251311 – zerkms

回答

0

我通常做類似加example.com/url/?nocache=<?php echo rand(); ?>將隨機數添加到URL,使每一個時間,以防止緩存它一個不同的URL。

+1

的OP不希望_force_的請求,從而繞過緩存,他想正好相反。 – CBroe

相關問題