Files
im_webapp/docker/nginx.conf
T
Your Name ca5e74ee98 修复静态资源发布后不生效: /umd/缓存策略从immutable改为no-cache
构建产物文件名不带内容哈希,一年免验证的缓存策略导致每次蓝绿发布后
浏览器和CDN都会继续吃旧版本,用户需要清缓存或开无痕窗口才能看到更新。
改为no-cache后浏览器/CDN每次都会带条件请求向源站确认,未变化时只是
一次很快的304,一旦文件真的变了会立刻拿到新内容,不再需要手动清缓存。
2026-08-12 12:54:41 +08:00

25 lines
696 B
Nginx Configuration File

server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Tinode webapp uses hash-based client-side routing, so any unknown path
# can safely fall back to index.html.
location / {
try_files $uri $uri/ /index.html;
}
# Filenames here aren't content-hashed, so a long/immutable cache would keep
# serving a stale bundle after every deploy. Force revalidation instead:
# cheap 304s when unchanged, immediate pickup of new content when not.
location /umd/ {
add_header Cache-Control "no-cache";
}
location /img/ {
add_header Cache-Control "public, max-age=86400";
}
}