解决的问题: 要防止网站根路径被缓存并返回304状态码
server {
listen 443 ssl;
...
# 根路径的location块
location = / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root www;
index index.html index.htm;
try_files $uri $uri/ /index.html last;
# 禁止缓存以及304响应
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
}