Pragma和Cache-control标头之间的区别? [英] Difference between Pragma and Cache-control headers?

查看:724
本文介绍了Pragma和Cache-control标头之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在维基百科上阅读了 Pragma 标题,其中写道:

I read about Pragma header on Wikipedia which says:


Pragma:no-cache标头字段是一个HTTP / 1.0标头,用于在请求中使用
。这是一种手段对于浏览器告诉服务器和
任何中间缓存,它想要一个新版本的资源,
不是服务器告诉浏览器不要缓存资源。一些
用户代理在响应中注意这个标题,但
HTTP / 1.1 RFC特别警告不要依赖这种行为。

"The Pragma: no-cache header field is an HTTP/1.0 header intended for use in requests. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh version of the resource, not for the server to tell the browser not to cache the resource. Some user agents do pay attention to this header in responses, but the HTTP/1.1 RFC specifically warns against relying on this behavior."

但我还不明白它的作用? Cache-Control 标头有什么区别,其值为 no-cache Pragma 其值也是 no-cache

But I haven't understood what it does? What is the difference between the Cache-Control header whose value is no-cache and Pragma whose value is also no-cache?

推荐答案

Pragma 是HTTP / 1.0实现, cache-control 是相同概念的HTTP / 1.1实现。它们都旨在阻止客户端缓存响应。较旧的客户端可能不支持HTTP / 1.1,这就是该标头仍在使用的原因。

Pragma is the HTTP/1.0 implementation and cache-control is the HTTP/1.1 implementation of the same concept. They both are meant to prevent the client from caching the response. Older clients may not support HTTP/1.1 which is why that header is still in use.

这篇关于Pragma和Cache-control标头之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆