-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
前提:
之前使用时注意到,面板更新内容后,如果通过域名访问面板,那么面板显示的是旧的内容,但是从 IP+端口 访问就是新的内容。
后面排查是 Nginx 配置上的问题。
例如一般可能的反向代理配置是:
location / {
proxy_pass http://127.0.0.1:6185;
proxy_set_header Host 127.0.0.1:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
proxy_set_header X-Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 30s;
proxy_read_timeout 86400s;
proxy_send_timeout 30s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
可以由此解决问题:
location = /index.html {
proxy_pass http://127.0.0.1:6185;
proxy_set_header Host $host;
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header Surrogate-Control "no-store" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
proxy_no_cache 1;
proxy_cache_bypass 1;
}
location /assets/ {
proxy_pass http://127.0.0.1:6185;
proxy_set_header Host $host;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
location / {
proxy_pass http://127.0.0.1:6185;
proxy_set_header Host $host;
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header Surrogate-Control "no-store" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
proxy_no_cache 1;
proxy_cache_bypass 1;
}
更新配置后,等待几分钟刷新页面(可以强制刷新: Ctrl + F5 )就好了
Metadata
Metadata
Assignees
Labels
No labels