nginx 禁止缓存全部扩展名非js css的文件
要禁止Nginx缓存所有扩展名非js和css的文件,可以在Nginx配置文件中添加以下代码:
location ~* \.(?!js|css)[^.]+$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
expires 0;
}
这将匹配所有不以.js和.css为扩展名的文件,并向响应头添加Cache-Control和Expires标头,以强制客户端不缓存这些文件。

原文地址: http://www.cveoy.top/t/topic/bmHK 著作权归作者所有。请勿转载和采集!