When developing and debugging the web, I often encounter the annoyance of clearing the cache or forcing a refresh to test due to the browser cache (cache). Provide the apache non-caching configuration and nginx non-caching configuration setting.
apache:
First make sure that the mod_headers module has been loaded in the configuration file httpd.conf.
LoadModule headers_module modules/mod_headers.so
We can let the browser read from the server every time according to the file type. Here, we use css, js, swf, php, html, and htm files for testing.
Header set Cache-Control “private, no-cache, no-store,
proxy-revalidate, no-transform”
Header set Pragma “no-cache”
nginx:
location ~ .*\.(css|js|swf|php|htm|html )$ {
add_header Cache-Control no-store;
}