From 8689a350e395545272be4daa064ac1fdf515dd07 Mon Sep 17 00:00:00 2001 From: jinghui Date: Thu, 12 Nov 2026 09:45:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(nginx):=20/articles/=20=E4=B8=8E=20index.ht?= =?UTF-8?q?ml=20=E7=A6=81=E7=94=A8=E5=90=AF=E5=8F=91=E5=BC=8F=E7=BC=93?= =?UTF-8?q?=E5=AD=98=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E7=94=A8=E6=88=B7=E7=AB=AF=E6=8A=A5=E3=80=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=89=BE=E5=88=B0=E8=BF=99=E7=AF=87=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 +++++++- nginx.conf | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 315a1d6..23f4717 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,13 @@ ## 2026-11-12 -### 🧩 新增「MCP 使用说明」教程 + 顶栏菜单 +### 🐛 修复:文章列表被浏览器缓存导致「没有找到这篇文章」 +- 根因:`/articles/` 下的 `index.json`/`.md` 此前无 `Cache-Control`,浏览器走启发式缓存,新增文章后用户端仍读旧列表,`ArticleDetail` 找不到条目即报「没有找到这篇文章:」 +- nginx 修复:`location /articles/` 与 `location = /index.html` 加 `Cache-Control: no-cache`(每次协商校验,命中 304 不费流量;入口页不缓存可避免旧 html 引用已失效的 chunk hash);`/homeAssets/` 30 天 immutable 长缓存保留不变 +- 验证:线上三类响应头均为 `Cache-Control: no-cache`,构建产物仍 `max-age=2592000 + public, immutable` +- 注意:已缓存旧列表的浏览器需强刷一次完成迁移,之后自动始终最新 + +### ✨ 新增「MCP 使用说明」教程 - 新文章 `public/articles/mcp-guide.md`(11.5KB 九节):MCP 概念与米剪 10 工具总览、端点与 Bearer 令牌(fail-closed/401)、**四种客户端接入模板**(Claude Desktop mcp-remote / Claude Code `claude mcp add` / Cursor mcp.json / Hermes config.yaml)、工具逐个详解(参数与默认值按 `mcp/server.py` 源码核实:`grab_url` 12000 字截断、`generate_script` 60 秒×4.5 字、`tts` 默认晓晓音色 ≤2000 字、`create_video_project` 30 图上限/160×120 门禁)、一句话生成视频实战链、curl 握手自检、`.env` 自部署配置、8 条常见问题 - 顶栏菜单加「**MCP 使用说明**」(`Header.tsx` nav,置于「使用教程」后,当前页自动高亮) diff --git a/nginx.conf b/nginx.conf index cd884b3..2a6ff1d 100644 --- a/nginx.conf +++ b/nginx.conf @@ -41,6 +41,18 @@ server { try_files $uri $uri/ /index.html; } + # 文章目录禁止启发式缓存:index.json 更新(新增文章/改标题)后必须立即可见, + # 否则浏览器按 ETag/Last-Modified 自行推断新鲜度会命中旧列表 → 详情页报 + # 「没有找到这篇文章」。no-cache = 每次协商校验(命中 304,不费流量)。 + location /articles/ { + add_header Cache-Control "no-cache"; + } + + # 入口页同样不缓存:旧 index.html 会引用已不存在的旧 chunk hash + location = /index.html { + add_header Cache-Control "no-cache"; + } + # 长缓存带 hash 的构建产物 location /homeAssets/ { expires 30d;