main
parent
2cb67fb291
commit
641acd8c9d
|
|
@ -7,20 +7,6 @@ server {
|
||||||
|
|
||||||
resolver ${RESOLVER} valid=30s ipv6=off;
|
resolver ${RESOLVER} valid=30s ipv6=off;
|
||||||
|
|
||||||
# 静态资源:命中直接返回文件并长时间缓存;缺失返回 404,绝不回退成 HTML,
|
|
||||||
# 避免 CDN/网关把误回退的 index.html 当资源缓存造成 MIME 报错。
|
|
||||||
location /assets/ {
|
|
||||||
try_files $uri =404;
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
||||||
access_log off;
|
|
||||||
}
|
|
||||||
|
|
||||||
# index.html 不缓存,保证每次回源拿到最新 hash 引用。
|
|
||||||
location = /index.html {
|
|
||||||
add_header Cache-Control "no-cache";
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue