feat(cache): 开启缓存默认仅缓存标准静态资源

路由缓存策略新增 static(内置扩展名,不含 HTML)与 all;
存量 url 规范为 all。OpenResty 渲染与代理路由 UI 同步。
This commit is contained in:
ryan
2026-07-18 23:32:49 +08:00
parent 7401f5d0b4
commit 04f029c705
11 changed files with 201 additions and 29 deletions
@@ -0,0 +1,22 @@
# 边缘缓存默认 static 策略 — 实现计划
对应设计:[edge-cache-design.md](../design/edge-cache-design.md)
## 目标
路由开启缓存后默认仅缓存标准静态扩展名(`static`);存量 `url` 映射为 `all`。
## 修改清单
1. **渲染** `pkg/render/openresty/render.go`:`static` 内置扩展名;`url`/`all` 无路径限制
2. **校验** `internal/apps/openflare/proxy_route/helpers.go`:策略枚举与规范化
3. **前端** `cache-section.tsx` + helpers:默认 `static`,选项文案
4. **测试** render + helpers
5. **changelog**
## 验证
```bash
go test ./pkg/render/openresty/ ./internal/apps/openflare/proxy_route/
make code-check # 或至少 go test + frontend tsc
```
+1
View File
@@ -17,6 +17,7 @@
* [WAF 可编排规则](./20260713-waf-orchestration.md):使用 React Flow 编辑 DAG 规则,发布时编译并由 OpenResty 纯内存执行。
* [边缘可观测与业务流量统计重构](./20260717-observability-redesign.md):访问日志为业务唯一真相;Agent 只上报明细与主机读数;收敛「出站/已提供」双字段。
* [访问日志 cache_status 明细可见](./20260718-access-log-cache-status.md):上报 `$upstream_cache_status`,明细展示命中/回源/未缓存三态。
* [边缘缓存默认 static 策略](./20260718-edge-cache-static-default.md):开启缓存默认仅静态扩展名;存量 url→all。
## 使用建议