> 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/edge/headers-and-cookies.md). Agents can also search and read this documentation through its [MCP server](https://www.axisnow.io/zh/docs/~gitbook/mcp).

# HTTP 头与 Cookie

边缘增删的请求头与响应头以及下发给浏览器的 Cookie

除下列各项外，边缘不改动请求头和响应头；插件按配置增删的头（回源控制的请求头改写、响应控制的自定义响应头和安全响应头）以各插件的文档为准。

## 发往源站的请求头 <a href="#request-headers" id="request-headers"></a>

<table data-search="false"><thead><tr><th width="190">请求头</th><th>值</th><th width="230">何时</th></tr></thead><tbody><tr><td><code>Host</code></td><td>回源 Host，取域的回源配置或回源控制的改写</td><td>始终</td></tr><tr><td><code>X-Real-IP</code></td><td>真实客户端 IP；边缘前面有代理时为<a href="https://www.axisnow.io/zh/docs/edge/policies/real-ip.md#get">获取</a>规则还原出的地址</td><td>始终；<a href="https://www.axisnow.io/zh/docs/edge/policies/real-ip.md#forward">转发</a>规则可改用其它头名</td></tr><tr><td><code>X-Forwarded-For</code></td><td>客户端原有的值之后追加与边缘建立连接的对端地址；原来没有时只有该地址</td><td>始终</td></tr><tr><td><code>X-Forwarded-Proto</code></td><td><code>http</code> 或 <code>https</code>，客户端到边缘的协议，覆盖客户端自带的值</td><td>始终</td></tr><tr><td><code>X-IPCountry</code></td><td>客户端 IP 所在国家 / 地区的两位代码，来自 IP 地址库</td><td>始终</td></tr><tr><td><code>Accept-Encoding</code></td><td>按 gzip、zstd、br、deflate 的顺序取客户端支持的第一个，只向源站声明这一种；都不支持时删除</td><td>命中可缓存规则的请求</td></tr><tr><td><code>Range</code></td><td>当前分片的字节范围</td><td>开启缓存分片时；其它情况删除，边缘取完整响应后自行应答 Range</td></tr></tbody></table>

`Proxy` 请求头在回源前删除。

## 返回给客户端的响应头 <a href="#response-headers" id="response-headers"></a>

<table data-search="false"><thead><tr><th width="190">响应头</th><th>值</th><th width="230">何时</th></tr></thead><tbody><tr><td><code>Server</code></td><td><code>Edge</code>，覆盖源站的值</td><td>始终</td></tr><tr><td><code>X-Request-ID</code></td><td>请求 ID，与日志检索里的 <code>request_id</code> 一致；阻断页和错误页上显示的 Request ID 即此值，用户报给您后可直接检索到这条请求</td><td>始终</td></tr><tr><td><code>X-Cache</code><br><code>Age</code><br><code>X-Cache-Key</code><br><code>X-Timestamp</code></td><td>缓存状态、副本年龄、Key 摘要、清理时间，见<a href="https://www.axisnow.io/zh/docs/edge/policies/cache/how-it-works.md#cache-status">缓存控制 › 缓存状态</a></td><td>命中缓存规则的响应</td></tr><tr><td><code>X-Mitigated</code></td><td><code>challenge</code></td><td>挑战的验证页</td></tr><tr><td><code>X-RateLimit</code><br><code>X-RateLimit-Limit</code><br><code>X-RateLimit-Reset</code></td><td>超限标记、阈值、限制期，见<a href="https://www.axisnow.io/zh/docs/edge/policies/rate-limiting/how-it-works.md#response-headers">速率控制 › 响应头</a></td><td>速率控制超限的响应</td></tr><tr><td><code>Strict-Transport-Security</code></td><td>按规则配置的 HSTS 策略，见 <a href="https://www.axisnow.io/zh/docs/edge/policies/ssl-tls/configuration.md#hsts">SSL/TLS › HSTS</a></td><td>开启 HSTS 时</td></tr><tr><td><code>Alt-Svc</code></td><td><code>h3=":443"; ma=86400</code>，向浏览器宣告 HTTP/3</td><td>开启 HTTP/3 时；未开启时删除源站的 <code>Alt-Svc</code></td></tr><tr><td><code>Server-Timing</code></td><td>规则中勾选的字段：<code>upstream-connect-time</code>、<code>upstream-first-byte-time</code>、<code>cache-hit-layer</code>、<code>cache-purge-timestamp</code>；字段只在适用时出现，如 <code>cache-hit-layer</code> 仅命中缓存的响应有。可在浏览器开发者工具的 Timing 面板查看</td><td>响应控制开启 Server-Timing 时</td></tr><tr><td><code>Report-To</code><br><code>NEL</code></td><td>浏览器网络错误日志的上报地址</td><td>开启用户体验监测时</td></tr><tr><td><code>WWW-Authenticate</code></td><td><code>Basic realm="Edge"</code></td><td>认证与授权的 Basic 认证失败</td></tr></tbody></table>

始终删除的响应头：`X-Accel-Buffering`、`X-Accel-Charset`、`X-Accel-Limit-Rate`、`X-Accel-Redirect`，它们只在边缘与源站之间有意义。命中缓存的响应不带 `Set-Cookie`，见[缓存控制 › 不缓存的响应](https://www.axisnow.io/zh/docs/edge/policies/cache/how-it-works.md#not-cached)。

## Cookie <a href="#cookies" id="cookies"></a>

边缘下发的 Cookie 都以 `__ct_` 开头，是提供防护和统计所必需的，不跨站点跟踪，值经签名或加密、不含个人信息，挑战相关的均为 HttpOnly。按所在地区的法规，您可能需要在站点的隐私声明中向访客披露。`_ac_`、`_rl_` 分别表示通用访问控制和速率控制下发，两者的凭证相互独立。

<table data-search="false"><thead><tr><th width="160">Cookie</th><th>用途</th><th width="150">有效期</th></tr></thead><tbody><tr><td><code>__ct_cya_ckt</code></td><td>会话标识：区分同一出口 IP 后面的不同浏览器。速率控制的<a href="https://www.axisnow.io/zh/docs/edge/policies/rate-limiting/configuration.md#dimensions">会话标识</a>维度读取它。请求没有带时在响应中下发</td><td>2 年</td></tr><tr><td><code>__ct_ac_alt</code><br><code>__ct_rl_alt</code></td><td>AxisNow 挑战的通过凭证，与规则、客户端 IP 和 TLS 指纹绑定，见<a href="https://www.axisnow.io/zh/docs/edge/policies/access-control/how-it-works.md#challenge-details">通用访问控制 › 挑战</a></td><td>规则的通过有效期</td></tr><tr><td><code>__ct_ac_cpt</code><br><code>__ct_rl_cpt</code></td><td>第三方挑战（Turnstile、reCAPTCHA）的通过凭证，绑定方式同上</td><td>规则的通过有效期</td></tr><tr><td><code>__ct_ac_cpg</code><br><code>__ct_rl_cpg</code></td><td>第三方挑战验证页下发的一次性门票，提交答案时校验，防止验证接口被直接调用</td><td>5 分钟</td></tr><tr><td><code>__ct_cya_chp</code></td><td>挑战前的 Cookie 预检：同一 IP 对同一条挑战规则在 10 秒内发出超过 100 次无凭证请求时，边缘以 307 Temporary Redirect 让浏览器带着它回来，再返回验证页；不保存 Cookie、不跟随跳转的工具到不了验证页</td><td>60 秒</td></tr></tbody></table>

## 边缘保留的路径 <a href="#reserved-paths" id="reserved-paths"></a>

以下路径在所有域上由边缘直接应答，不回源，也不经过策略里的规则，因此不需要在挑战或限速规则中排除；站点自己的路径要避开它们，安全扫描器对这些路径的报告可以忽略。

<table data-search="false"><thead><tr><th width="300">路径</th><th>用途</th></tr></thead><tbody><tr><td><code>/.well-known/acme-challenge/</code></td><td>证书申请的 HTTP 验证，见<a href="https://www.axisnow.io/zh/docs/edge/endpoints/certificates/issuance.md">证书 › 申请与续签</a></td></tr><tr><td><code>/aegis_altcha_verify</code><br><code>/aegis_captcha_verify</code></td><td>AxisNow 挑战、第三方挑战的答案提交接口</td></tr><tr><td><code>/aegis_altcha_object/*.js</code></td><td>AxisNow 挑战的验证脚本</td></tr><tr><td><code>/aegis/precheck</code></td><td>挑战前的 Cookie 预检跳转</td></tr><tr><td><code>/edge/real-user-observability.js</code></td><td>用户体验监测的采集脚本</td></tr><tr><td><code>/aegis_node_ping/</code></td><td>平台对节点的连通性探测</td></tr></tbody></table>


---

# 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/edge/headers-and-cookies.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.
