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 type | General header |
---|---|
Forbidden header name | no |
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 theDate
header.
Warning codes
The HTTP Warn Codes registry at iana.org defines the namespace for warn codes.
Code | Text | Description |
---|---|---|
110 | Response is Stale | A response provided by a cache is stale (the expiration time set for it has passed). |
111 | Revalidation Failed | An attempt to validate the response failed, due to an inability to reach the server. |
112 | Disconnected Operation | The cache is disconnected from the rest of the network. |
113 | Heuristic Expiration | Sent If a cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours. |
199 | Miscellaneous Warning | Arbitrary, non-specific warning |
214 | Transformation Applied | Added by a proxy if it applies any transformation to the representation, such as changing the content-coding, media-type or the like. |
299 | Miscellaneous Persistent Warning | Same 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
Specification | Title |
---|---|
RFC 7234, section 5.5: Warning | Hypertext Transfer Protocol (HTTP/1.1): Caching |
Browser compatibility
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论