HTTP 标头 |警告
HTTP 标头允许客户和服务器通过 HTTP 请求或响应传递附加信息。警告通用 HTTP 标头包含有关可能未反映在消息中的消息状态的潜在问题的信息。该字段本身由警告代码、警告代理、警告文本和可选警告日期组成。响应中可能会显示多个警告标头。警告标头字段可以应用于任何消息,但是,用于警告缓存操作可能缺乏语义透明度,并且只能应用于转换消息。
句法:
Warning: <3-DIGIT-warn-code> [< SP warn-date>]
指令:此标头接受上述四个指令,如下所述:
- 1xx warn-codes:描述响应的新鲜度或重新验证状态,重新验证成功后必须删除。仅在批准缓存条目时由缓存生成。不得由客户产生。
- 2xx警告代码:它描述了表示的某些方面,该方面没有被验证纠正,并且在批准后不会被缓存删除,除非发送了完整的响应。
下表列出了警告代码和推荐的警告文本: Response is Stale Revalidation Failed Disconnected Operation Heuristic Expiration Miscellaneous Warning Transformation Applied Miscellaneous Persistent WarningWarn-Code Warn-Text Description 110 It must be included whenever a sent response is stale. 111 It must be incorporated if a cache returns a stale response because an endeavor to approve the failed response, due to an powerlessness to reach the server. 112 It ought to be incorporated if the cache is deliberately disengaged from the rest of the server network for a period of time. 113 It must be encapsulated if a cache heuristically picks a caching freshness lifetime greater than 24 hours and the response’s age is more than 24 hours. 199 The warning-text may include whimsical information to be introduced to a client. A framework accepting this sort of caution must not make any automated step, other than introducing the caution to the client. 214 It ought to be incorporated by a proxy or cache on the off chance that it applies any change to response, for example, changing the content-coding, media-type of the response, or the entity-body of the response, unless this caution code already appears in the response.
299 This is same as warn-code 199, yet illustrate a obstinate warning message to the user.
例子:
Warning: 246 - "Embedded Warning" "sat, 05 Oct 2019 10:47:47 GMT"
Warning: 199 -"Miscellaneous warning" "sun, 18 Oct 2015 07:28:00 GMT"
支持的浏览器: HTTP头警告支持的浏览器如下:
- 谷歌浏览器
- IE浏览器
- 火狐
- 苹果浏览器
- 歌剧
- 边缘