---
url: /config/outbounds/http.md
---
# HTTP

HTTP 协议。

::: danger
**http 协议没有对传输加密，不适宜经公网中传输，更容易成为被人用作攻击的肉鸡。**
:::

::: tip
`http` 只能代理 tcp 协议，udp 系的协议均不能通过。
:::

## OutboundConfigurationObject

`OutboundConfigurationObject` 对应 [`OutboundObject`](../outbound.md) 中的 `settings` 项。

```json
{
  "outbounds": [
    {
      // ...
      "protocol": "http",
      // [!field focus]
      "settings": {
        "address": "192.168.108.1",
        "port": 3128,
        "user": "my-username",
        "pass": "my-password",
        "level": 0,
        "email": "love@xray.com",
        "headers": {
          "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36",
          "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2"
        }
      }
    }
  ]
}
```

::: tip
目前 HTTP 协议 outbound 中 `streamSettings` 设置 `security` 和 `tlsSettings` 是生效的。
:::

> `address`: string

HTTP 代理服务器地址，必填。

> `port`: int

HTTP 代理服务器端口，必填。

> `user`: string

用户名，字符串类型。如果对接服务端需要认证则必填，否则不要包含此项。

> `pass`: string

密码，字符串类型。如果对接服务端需要认证则必填，否则不要包含此项。

> `level`: number

用户等级，连接会使用这个用户等级对应的 [本地策略](../policy.md#levelpolicyobject)。如果对接服务端需要认证则选填，否则不要包含此项。

userLevel 的值, 对应 [policy](../policy.md#policyobject) 中 `level` 的值。 如不指定, 默认为 0。

> `email`: string

邮件地址，用于标识用户。如果对接服务端需要认证则选填，否则不要包含此项。

> `headers`: map{ string, string }

HTTP 头，一个键值对，每个键表示一个 HTTP 头的名称，每次请求会附上所有的键值对。
