互联网工程任务组 (IETF) M. Nottingham
请求评注: 9209 Fastly
类别: 标准轨道 P. Sikora
ISSN: 2070-1721 Google
2022年6月

代理状态 HTTP 响应头字段


摘要

本文档定义了 Proxy-Status HTTP 响应字段,用于传递中间节点在响应处理过程中的详细信息,包括生成的错误。

本备忘录的状态

这是一个互联网标准轨道文档。

本文档是互联网工程任务组 (IETF) 的成果,代表了 IETF 社区的共识。它已接受公开审查并已获得互联网工程指导组 (IESG) 批准发布。关于互联网标准的更多信息,请参阅 RFC 7841 的第 2 节

有关本文档当前状态、任何勘误以及如何提供反馈的信息,可在 https://www.rfc-editor.org/info/rfc9209 获取。

Copyright Notice

Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.


1. 介绍

HTTP 中间节点(参见 第 3.7 节[HTTP])——包括正向代理和网关(也称为“反向代理”)——已成为 HTTP 部署中日益重要的一部分。特别是,反向代理和内容分发网络(CDN)构成了许多网站的关键基础设施的一部分。

通常,HTTP 中间节点将请求向源服务器转发(入站),然后将其响应转回客户端(出站)。然而,如果在从入站服务器获取响应之前发生错误,则响应通常由中间节点自身生成。

HTTP 使用一些状态码来处理这类错误 —— 例如 502(Bad Gateway)和 504(Gateway Timeout)。但实践表明,为了便于调试并向客户端传达发生了什么,需要更多信息。另外,中间节点有时希望传达有关其处理响应的附加信息,即使它们并未生成该响应。

为实现这些用途,第 2 节 定义了一个新的 HTTP 响应字段,允许中间节点传达其处理响应的详细信息。第 2.1 节 列举了中间节点可添加到该字段的信息,这些信息可按 第 2.2 节 扩展。第 2.3 节 定义了一组在代理在获取请求的响应时遇到问题时使用的错误类型;这些也可以按 第 2.4 节 扩展。

1.1. 表示约定

本文档中的关键词 "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", 和 "OPTIONAL" 当且仅当全部大写时,按 BCP 14 中的描述解释,参见 [RFC2119][RFC8174]

本文档使用来自 [STRUCTURED-FIELDS] 第 3 节 的术语来指定语法和解析:List、String、Token、Integer 和 Byte Sequence。

注意,在本规范中,“proxy” 用于指代正向和反向代理(即网关)。“next hop” 表示通向请求的源服务器方向上的连接。



3. IANA 考量

IANA 已创建“HTTP Proxy-Status Parameters”注册表和“HTTP Proxy Error Types”注册表,位于 <https://www.iana.org/assignments/http-proxy-status>,并已使用第 2.1 节2.3 节 中定义的类型填充;有关相关程序,请参见 2.2 节2.4 节

此外,以下条目已添加到“超文本传输协议 (HTTP) 字段名注册表”:

字段名:
Proxy-Status
状态:
permanent
规范文件:
RFC 9209
备注:
 

4. 安全性考虑

使用 Proxy-Status 时的主要安全关注点之一是泄露可能帮助攻击者的信息。例如,中介的配置和后端拓扑信息可能被暴露,使攻击者能够直接针对未准备好应对高流量或畸形输入的后端服务。一些信息可能仅适合向授权方披露。

因此,在决定生成 Proxy-Status 字段及包含何种信息时需要谨慎。请注意,中介并不要求在任何响应中生成 Proxy-Status 字段,并且可以基于请求属性(例如认证令牌、IP 地址)有条件地生成它们。

同样,所有参数的生成都是可选的,字段本身的生成也是可选的。此外,该字段的内容不会被验证;中介可以声称执行了某些操作(例如通过加密通道发送请求),但实际上可能并未执行。

5. 参考文献

5.1. 规范性参考文献

[HTTP]
Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., “HTTP Semantics”, STD 97, RFC 9110, DOI 10.17487/RFC9110, June 2022, <https://www.rfc-editor.org/info/rfc9110>.
[RFC2119]
Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels”, BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.
[RFC7301]
Friedl, S., Popov, A., Langley, A., and E. Stephan, “Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension”, RFC 7301, DOI 10.17487/RFC7301, July 2014, <https://www.rfc-editor.org/info/rfc7301>.
[RFC8126]
Cotton, M., Leiba, B., and T. Narten, “Guidelines for Writing an IANA Considerations Section in RFCs”, BCP 26, RFC 8126, DOI 10.17487/RFC8126, June 2017, <https://www.rfc-editor.org/info/rfc8126>.
[RFC8174]
Leiba, B., “Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words”, BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC8499]
Hoffman, P., Sullivan, A., and K. Fujiwara, “DNS Terminology”, BCP 219, RFC 8499, DOI 10.17487/RFC8499, January 2019, <https://www.rfc-editor.org/info/rfc8499>.
[RFC8914]
Kumari, W., Hunt, E., Arends, R., Hardaker, W., and D. Lawrence, “Extended DNS Errors”, RFC 8914, DOI 10.17487/RFC8914, October 2020, <https://www.rfc-editor.org/info/rfc8914>.
[STRUCTURED-FIELDS]
Nottingham, M. and P-H. Kamp, “Structured Field Values for HTTP”, RFC 8941, DOI 10.17487/RFC8941, March 2021, <https://www.rfc-editor.org/info/rfc8941>.
[TLS]
Rescorla, E., “The Transport Layer Security (TLS) Protocol Version 1.3”, RFC 8446, DOI 10.17487/RFC8446, August 2018, <https://www.rfc-editor.org/info/rfc8446>.

5.2. 信息性参考文献

[RFC8586]
Ludin, S., Nottingham, M., and N. Sullivan, “Loop Detection in Content Delivery Networks (CDNs)”, RFC 8586, DOI 10.17487/RFC8586, April 2019, <https://www.rfc-editor.org/info/rfc8586>.

作者地址

Mark Nottingham
Fastly
Prahran
Australia
EMail: mnot@mnot.net
URI: https://www.mnot.net/
Piotr Sikora
Google
EMail: piotrsikora@google.com