fix: 终审微修(admin no-cache/PII挂账/死配置清理)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+7
-2
@@ -257,9 +257,14 @@ app.mount("/admin", AdminSPA(), name="admin")
|
||||
async def static_no_cache(request, call_next):
|
||||
"""静态资源协商缓存(2026-09-30 线上事件): 无 Cache-Control 时浏览器对
|
||||
widget.js 走启发式缓存,修复部署后用户端仍跑旧脚本。no-cache=每次用
|
||||
etag 轻量协商,有更新即时生效,未变则 304 几乎零开销。"""
|
||||
etag 轻量协商,有更新即时生效,未变则 304 几乎零开销。
|
||||
/admin 同覆盖(终审微修): SPA 的 index.html 引用带 hash 的 assets——
|
||||
管理员端旧 index 被启发式缓存会引旧 assets 白屏(与 widget.js 事件
|
||||
同类);index 每次协商,hash 资源未变则 304,开销可忽略。"""
|
||||
resp = await call_next(request)
|
||||
if request.url.path.startswith("/static/"):
|
||||
path = request.url.path
|
||||
if (path.startswith("/static/")
|
||||
or path == "/admin" or path.startswith("/admin/")):
|
||||
resp.headers["Cache-Control"] = "no-cache"
|
||||
return resp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user