关于 :authority 和 host 的说明


【Note on :authority and host

HTTP/2 要求请求必须包含 :authority 伪头部或 host 头部。在直接构建 HTTP/2 请求时,优先使用 :authority;在从 HTTP/1 转换时(例如在代理中),优先使用 host

【HTTP/2 requires requests to have either the :authority pseudo-header or the host header. Prefer :authority when constructing an HTTP/2 request directly, and host when converting from HTTP/1 (in proxies, for instance).】

如果没有 :authority,兼容性 API 会回退到 host。更多信息请参见 request.authority。然而,如果你不使用兼容性 API(或直接使用 req.headers),你需要自己实现任何回退行为。

【The compatibility API falls back to host if :authority is not present. See request.authority for more information. However, if you don't use the compatibility API (or use req.headers directly), you need to implement any fall-back behavior yourself.】