Home  >  Article  >  Backend Development  >  javascript - cache-control sets css to force cache invalidation

javascript - cache-control sets css to force cache invalidation

WBOY
WBOYOriginal
2016-12-01 00:56:281658browse

I want to force caching of my a.css file.
The method I use is to modify apcache’s httpd.conf. The code is as follows:

<code>LoadModule headers_module modules/mod_headers.so
header set cache-control "max-age=1000"</code>

Debugging found that cache-control has been set correctly:

javascript - cache-control sets css to force cache invalidation

But it still doesn’t work:

Ideally it should return 200, and then the Size is from cache.

javascript - cache-control sets css to force cache invalidation

Puzzled...

Reply content:

I want to force caching of my a.css file.
The method I use is to modify apcache’s httpd.conf. The code is as follows:

<code>LoadModule headers_module modules/mod_headers.so
header set cache-control "max-age=1000"</code>

Debugging found that cache-control has been set correctly:

javascript - cache-control sets css to force cache invalidation

But it still doesn’t work:

Ideally it should return 200, and then the Size is from cache.

javascript - cache-control sets css to force cache invalidation

Puzzled...

The results will be different depending on the refresh action. Please check:

Press enter in the address bar: If there is a browser cache, read the cache from disk cache
F5/ctrl+r: It will request the browser anyway, and if the resource has not expired, it will return 304
ctrl +F5: Requests will be made to the browser anyway, forcing the resource to be returned 200

Thank you, right click on the chrome refresh button. You can also see the status mentioned above

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn