Warning - HTTP 编辑

Note: The Warning header is soon to be deprecated; see Warning (https://github.com/httpwg/http-core/issues/139) and Warning: header & stale-while-revalidate (https://github.com/whatwg/fetch/issues/913) for more details.

The Warning general HTTP header contains information about possible problems with the status of the message. More than one Warning header may appear in a response.

Warning header fields can in general be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages.

Header typeGeneral header
Forbidden header nameno

Syntax

Warning: <warn-code> <warn-agent> <warn-text> [<warn-date>]

Directives

<warn-code>
A three-digit warning number. The first digit indicates whether the Warning is required to be deleted from a stored response after validation.
  • 1xx warn-codes describe the freshness or validation status of the response and will be deleted by a cache after deletion.
  • 2xx warn-codes describe some aspect of the representation that is not rectified by a validation and won't be deleted by a cache after validation unless a full response is sent.

<warn-agent>

The name or pseudonym of the server or software adding the Warning header (might be "-" when the agent is unknown).

<warn-text>
Advisory text describing the error.
<warn-date>
Optional. If more than one Warning header is sent, include a date that matches the Date header.

Warning codes

The HTTP Warn Codes registry at iana.org defines the namespace for warn codes.

CodeTextDescription
110Response is StaleA response provided by a cache is stale (the expiration time set for it has passed).
111Revalidation FailedAn attempt to validate the response failed, due to an inability to reach the server.
112Disconnected OperationThe cache is disconnected from the rest of the network.
113Heuristic ExpirationSent If a cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours.
199Miscellaneous WarningArbitrary, non-specific warning
214Transformation AppliedAdded by a proxy if it applies any transformation to the representation, such as changing the content-coding, media-type or the like.
299Miscellaneous Persistent WarningSame as 199, but indicating a persistent warning

Examples

Warning: 110 anderson/1.3.37 "Response is stale"

Date: Wed, 21 Oct 2015 07:28:00 GMT
Warning: 112 - "cache down" "Wed, 21 Oct 2015 07:28:00 GMT"

Specifications

SpecificationTitle
RFC 7234, section 5.5: WarningHypertext Transfer Protocol (HTTP/1.1): Caching

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:51 次

字数:5471

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文