我有一个在NGINX上运行的Web应用程序。
我正在尝试阻止NGINX缓存JSON、JS、CSS文件。
我的配置如下:
server {
listen 0.0.0.0:80;
root /usr/share/nginx/html;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
location / {
try_files $uri $uri/ /index.html;
}
location ~* /.(css|js|json)$ {
expires -1;
add_header Cache-Control:no-store, no-cache;
}
}
字符串
当我在浏览器中查看时,我仍然看到文件是(磁盘缓存)。
我做错了什么?
谢谢.
我尝试使用just expires -1;尝试仅对JSON文件应用此过滤器。尝试仅使用no-cache头
而且我不能不从缓存中提供文件。
1条答案
按热度按时间w6lpcovy1#
你可以设置它来绕过它:
字符串