> For the complete documentation index, see [llms.txt](https://www.axisnow.io/zh/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.axisnow.io/zh/docs/edge/policies/cache/faq.md).

# 常见问题

缓存控制的常见疑问与排错

<details>

<summary>怎么判断一个请求有没有走缓存？</summary>

看响应头 `X-Cache`：`HIT` 命中，`MISS` 未命中并回源，`BYPASS` 命中了绕过规则。没有这个头说明没有任何规则命中，这个请求根本不在缓存控制的范围内。

</details>

<details>

<summary>配置了可缓存，为什么一直 MISS？</summary>

先看 `X-Cache` 是 `BYPASS` 还是 `MISS`。`BYPASS` 是命中了绕过规则，检查规则范围。`MISS` 按出现频率排查：响应带 `Set-Cookie`；源站返回 `Cache-Control: no-store`、`private`、`no-cache` 或 `max-age=0`，而模式是遵循源站或源站优先；响应带 `Vary: *`；状态码落在平台规则的不缓存范围（5xx）；缓存 Key 把 Cookie 或查询参数全部算进去，每次请求 Key 都不同。排查时用 `curl -s -o /dev/null -D - <URL>` 连续请求两次，第二次应为 `HIT` 且 `Age` 增长，否则对照两次的 `X-Cache-Key` 是否一致；不要用 `curl -I`，HEAD 与 GET 是两份副本。每个节点独立存储，请求落到另一个节点时再次 `MISS` 是正常现象。

</details>

<details>

<summary>HTML 页面为什么没有缓存？</summary>

默认规则只覆盖常见静态文件后缀，HTML 和 API 响应不在其中。按[缓存 HTML 页面](/zh/docs/edge/policies/cache/use-cases.md#html)添加规则。

</details>

<details>

<summary>清理之后用户看到的还是旧内容</summary>

依次确认：浏览器本地还有副本，和边缘无关，用无痕窗口或 `curl` 验证；清理的 URL 与请求的域名路径不一致，清理不区分协议和参数但区分路径；任务还没到达该节点，等几秒再试。边缘生效后第一次请求的 `X-Cache` 为 `EXPIRED` 或 `REVALIDATED`：后者说明源站以 304 回答“内容未变”，去检查源站的 `Last-Modified`、`ETag` 是否随内容更新。

</details>

<details>

<summary>命中率为什么上不去？</summary>

命中率按站点总请求计算，动态接口多的站点天然偏低，先看静态资源单独的命中情况。常见原因是缓存 Key 过细（查询参数或 Cookie 选了全部）、缓存时长过短、节点多而每个节点各自回源一次。带指纹的静态资源用预设**静态资源**并给长时长。

</details>

<details>

<summary>源站故障时，边缘会继续用缓存应答吗？</summary>

新鲜的副本会，过期的不会：过期副本回源失败时直接返回源站的错误，不会用旧内容兜底。

</details>

<details>

<summary>用户 A 看到了用户 B 的页面</summary>

含个人信息的响应被缓存成了公共副本。给这类路径加绕过缓存规则；必须缓存的，把标识用户的 Cookie 加入缓存 Key。带 `Set-Cookie` 的响应本身不会缓存，但登录后的页面通常不再下发 `Set-Cookie`，不能依赖这一点。

</details>

<details>

<summary>预热之后为什么还是 MISS？</summary>

URL 没有命中可缓存规则，预热不会写入；http 与 https 是两份副本，只预热了另一个协议；节点是预热之后新增的；或者任务还在排队，节点每 10 秒领取一次。洞察页的任务明细能看到每个节点每条 URL 的结果。

</details>

<details>

<summary>大文件下载很慢或断点续传失败</summary>

开启缓存分片并确认源站支持 Range 请求：只有开启分片时 Range 才透传到源站，见[缓存分片](/zh/docs/edge/policies/cache/configuration.md#slice)。

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.axisnow.io/zh/docs/edge/policies/cache/faq.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
