2021-03-15 23:59:11 +08:00

43 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
date: "2020-12-23T00:00:00.000Z"
description: Project X 的文档.
title: HTTP/2
weight: 5
---
基于 HTTP/2 的传输方式。
它完整按照 HTTP/2 标准实现,可以通过其它的 HTTP 服务器(如 Nginx进行中转。
由 HTTP/2 的建议,客户端和服务器必须同时开启 TLS 才可以正常使用这个传输方式。
::: tip
当前版本的 HTTP/2 的传输方式并不强制要求服务器端有 TLS 配置.
这使得可以在特殊用途的分流部署环境中,由外部网关组件完成 TLS 层对话Xray 作为后端应用,网关和 Xray 间使用称为 `h2c` 的明文 http/2 进行通讯。
## HttpObject
---
`HttpObject` 对应传输配置的 `httpSettings` 项。
```json
{
"host": ["xray.com"],
"path": "/random/path"
}
```
> `host`: \[string\]
一个字符串数组,每一个元素是一个域名。
客户端会随机从列表中选出一个域名进行通信,服务器会验证域名是否在列表中。
> `path` string
HTTP 路径,由 `/` 开头, 客户端和服务器必须一致。
默认值为 `"/"`