HTTP Pragma 标头是一个与实现相关的标头,在请求——响应链中可能会产生各种不同的影响。此标头用于向后兼容不支持 HTTP/1.1 中 Cache-Control 标头的 HTTP/1.0 缓存。
[!NOTE]
Pragma标头并未在 HTTP 响应中定义,因此不能可靠地替代 HTTP/1.1 中的Cache-Control标头,虽然在请求中省略Cache-Control标头时,Pragma的行为与Cache-Control: no-cache相同,但请仅将其用于向后兼容 HTTP/1.0 客户端。
<table class="properties"> <tbody> <tr> <th scope="row">标头类型</th> <td> Request header、Response header(响应行为未作明确规定,且依赖于具体实现)。 </td> </tr> <tr> <th scope="row">Forbidden request header</th> <td>否</td> </tr> <tr> <th scope="row"> CORS-safelisted response header </th> <td>是</td> </tr> </tbody> </table>
语法
Pragma: no-cache
指令
no-cache- : 与
Cache-Control: no-cache相同。该设置会强制缓存将请求提交给源服务器进行验证,之后才会释放已缓存的副本。
- : 与
示例
Pragma: no-cache
规范
浏览器兼容性
参见
- Cache-Control
- Expires
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
