Is the browser cache controlled by the back end or the front end?

Baidu has a general understanding of the strong caching and negotiation caching of browser caches. It feels as if the server is set back, and the front-end code does not need to be set. Is the browser cache really set on the server side, and does the front end normally adjust the interface request like this?

Oct.05,2021

is indeed a server setting, but the front end also needs to know how to set it.
it is up to the front end to determine which resources are cached, how to cache them, and how to update them.
in addition to browser caches, there are also local caches, storage, indexedDB, etc. In the future, you have to know all about service workers, before you can decide which cache is more suitable for current business needs.


the front end can also be set (in the meta), and the back end can be set (in the response header), depending on the specific business needs. For example, if there are several H5 display pages on the mobile side, I think it is fine to set them uniformly on the server; but if it is an official website or a page with compound functions, it is OK to set it at the front end or at the back end. You don't have to write this into the code, but you still need to understand it. (it's best to learn the basic process of HTTP,. Just look at the "schematic HTTP"), which will be helpful in understanding the business and the overall architecture.

Menu