# 自定义请求头

网页解锁器（Web Unblocker）支持使用自定义 HTTP 请求头，您可根据具体用例灵活定制请求。

### 允许请求头（可直接转发）

允许使用下列请求头，可以原封不动地经过解锁器发送到目标服务器：

* Cookie
* User-Agent
* Accept-Language
* Accept-Encoding
* 自定义请求头（如X-My-Header）
* [不在“禁止列表”中的其他请求头](#jin-zhi-zhu-tiao-qing-qiu-tou)

示例用法：

```
curl -x <http://unblocker.example> \\
     --proxy-user user:pass \\
     -H 'Cookie: user=hello; theme=dark' \\
     -H 'X-My-Header: custom-value' \\
     <https://httpbin.org/headers>
```

### User-Agent规则

如果您的客户端：

* 使用 `User-Agent: curl/... 或 User-Agent: wget/...`
* 或完全不发送 `User-Agent`

那么解锁器会将其替换为一个随机的浏览器 User-Agent，例如

```
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/134.0.0.0 Safari/537.3
```

### 禁止（逐跳）请求头

以下请求头会被解锁器删除：

* Connection
* Keep-Alive
* Proxy-Authenticate
* Proxy-Authorization
* Proxy-Connection
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* X-Render-JS

### Chromium引擎（触发时）忽略的请求头

当解锁器启用 Chromium引擎时，下列请求头也会被忽略

* Content-Length
* Host
* Cookie2
* Keep-Alive
* Set-Cookie
* Origin
* Referer
* 任意 `Sec-Fetch-*` 请求头

Chromium 还会强制把 *Accept* （可接受）请求头改写为：

```
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,
        image/avif,image/webp,image/apng,*/*;q=0.8
```

因此，即使你明确传入了“application/json”，最终得到的仍然可能是上述结果。

详情请参阅[Chromium 官方文档](https://github.com/chromium/chromium/blob/main/services/network/public/cpp/header_util.cc) 。<br>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iproyal.com/cn/gong-ju/wang-luo-jie-suo-qi/zi-ding-yi-qing-qiu-tou.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
