In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
First, the browser's handling of the cache: Internet option
★ controls the request server policy: it means to force the request server in case of ignoring the caching policy of the resource.
★ checks the stored page for newer versions
1. Every time you visit a web page
The server is requested again, regardless of whether there is a cache or whether the resource status has expired.
two。 Every time you start Internet Explorer
The server is requested again, regardless of whether there is a cache or whether the resource status has expired.
3. Automatic
It's basically the same as 2, but the strategy for the picture is a little different.
4. Never.
Request the server exactly according to the caching policy of the resource.
★ F5 refresh: request the server, but will determine whether to download or not based on comparing the file with the server
★ Ctrl + F5 Refresh: be sure to go to the server to download.
Second, cache control strategy
★ Last-Modified/If-Modified-Since should be used with Cache-Control, and Etag/If-None-Match should be used with Cache-Control.
Ps: the last-modified of files between multiple machines in a distributed system must be consistent, so as not to cause alignment failure due to load balancing to different machines
Distributed systems try to turn off Etag (each machine generates a different etag)
★ HTML controls browser caching policy through the http-equiv property of meta: by setting Pragma and Cache-control and expires control
Ps: you can only control the caching policy of html, not the caching policy of css/js/ images.
Max-age and expires of Cache-control exist at the same time, so deal with max-age first.
After Cache-control specifies no-cache, max-age and expires.
Pragma: it is only recognized by http 1.0 IE browser. It is not reflected in the request header, but it does have an effect.
Cache-control: http 1.1
3. Nginx sets browser cache
★ Nginx sets browser cache: can be added in http, server, location nodes. You can set caching policies for a variety of resources, not just HTML. The node is only for HTML
# add_header Cache-Control no-cache; # add_header Cache-Control private; add_header Cache-Control max-age=7200; if ($request_filename ~ * ^. *?\. (ico | jpeg | gif | jpg | png | woff) $) {expires 7d;} if ($request_filename ~ * ^. *?\. (js | css) $) {expires 7d;} if ($request_filename ~ * ^. *?\. (html | htm) $) {expires 3d;}
The configuration in ★ Nginx overrides the http-equiv= "Cache-control" configuration of HTML.
However, if the following three tags are added to HTML, the browser-side effect can only be no-cache. (in effect: the Cache-control configuration of Nginx is invalid)
Because Nginx's Cache-control configuration only overrides Cache-control (Nginx is still valid if html is tagged with the last two tags), while Pragma still works.
Summary
The above is the editor to introduce to you the Nginx and browser cache processing methods, I hope to help you, if you have any questions, please leave me a message, the editor will reply you in time. Thank you very much for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.