Many people asked, isn't it all refreshed? What is the difference? Actually, there are still some.
Press enter in the address bar. First, the requested URI does not expire in the browser cache. In this case, the HTTP Request Message Header displayed in the browser using the firebug plug-in of Firefox is as follows:
Host 192.168.3.174: 8080
User-Agent Mozilla/5.0 (Windows NT 5.1; RV: 5.0) Gecko/20100101 Firefox/5.0
Accept text/html, application/XHTML + XML, application/XML; q = 0.9, */*; q = 0.8
Accept-language ZH-CN, ZH; q = 0.5
Accept-encoding gzip, deflate
Accept-charset gb2312, UTF-8; q = 0.7, *; q = 0.7
Connection keep-alive
HTTP return status: 200
OK. However, the access. log of the nginx server does not find the request record, indicating that the request is not actually submitted to the HTTP server. It is discovered by the browser that the cache contains
An unexpired file directly intercepts the request. firebug shows that the so-called "Request Header message" and "Response Header message" are all "forged" by the browser. This type of refresh requires the minimum network traffic.
It can be said that there is no, and the time consumption is also the least. Just as if you find a box of milk that has not expired, you feel that there is no problem. If no one tells you, you can drink it.
Second, the requested URI has expired in the browser cache. At this time, the HTTP Request Message Header displayed by firebug is as follows:
Host 192.168.3.174: 8080
User-Agent Mozilla/5.0 (Windows NT 5.1; RV: 5.0) Gecko/20100101 Firefox/5.0
Accept text/html, application/XHTML + XML, application/XML; q = 0.9, */*; q = 0.8
Accept-language ZH-CN, ZH; q = 0.5
Accept-encoding gzip, deflate
Accept-charset gb2312, UTF-8; q = 0.7, *; q = 0.7
Connection keep-alive
If-modified-since Mon, 04 Jul 2011 10:12:40 GMT
If-modified-since is added, the access. log of the nginx server in the background also finds the request record, indicating that the browser can handle this situation:
Ask the server if the requested URI has been modified after a certain time, which is determined by the last-modified of the last HTTP response. The server has not been repaired after authentication.
If it is changed, the system returns 304 not modified. After the browser receives the modification, it reads the content from the cache. If it is modified, the system returns 200.
OK, and new content is returned. In this situation, you find a box of expired milk, and ask someone else if they can drink it. If someone else says yes, you will drink it. If someone else says no, then you have
Find a box of fresh milk.
For F5 refresh, the HTTP request message header is as follows:
Host 192.168.3.174: 8080
User-Agent Mozilla/5.0 (Windows NT 5.1; RV: 5.0) Gecko/20100101 Firefox/5.0
Accept text/html, application/XHTML + XML, application/XML; q = 0.9, */*; q = 0.8
Accept-language ZH-CN, ZH; q = 0.5
Accept-encoding gzip, deflate
Accept-charset gb2312, UTF-8; q = 0.7, *; q = 0.7
Connection keep-alive
If-modified-since Mon, 04 Jul 2011 10:12:40 GMT
Cache-control Max-age = 0
There is another row of cache-control:
Max-age = 0, meaning that no matter whether the file in the browser cache has expired, I will go to the server to ask, which is equivalent to the temporary expiration of the expires in the last HTTP response. Server Response
The process is the same as above. In this case, if you find a box of milk and do not check its validity period, you can directly ask others if they can drink it.
Finally, press Ctrl + F5 to refresh. The HTTP request message header is as follows:
Host 192.168.3.174: 8080
User-Agent Mozilla/5.0 (Windows NT 5.1; RV: 5.0) Gecko/20100101 Firefox/5.0
Accept text/html, application/XHTML + XML, application/XML; q = 0.9, */*; q = 0.8
Accept-language ZH-CN, ZH; q = 0.5
Accept-encoding gzip, deflate
Accept-charset gb2312, UTF-8; q = 0.7, *; q = 0.7
Connection keep-alive
Pragma no-Cache
Cache-control no-Cache
If-modified-since is absent, cache-control is replaced with no-Cache. In addition, The Pragma line is used to be compatible with http1.0.
Cache-control:
No-cache is the same. This means that I do not need to cache files, force refresh, and directly download the files to the server, so the server's response processing is the same as the first request for this Uri and returns
200 OK and new content. This type of refresh requires the largest and most time-consuming network traffic. This is like you have found a box of milk, but you threw it away and went straight to buy a new box.
Additional reading: http://www.cnblogs.com/cxd4321/archive/2009/03/11/1408425.html
From: http://blog.csdn.net/yui/article/details/6584401