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

查看:47
本文介绍了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."

但我还没明白它的作用是什么?其值为 no-cacheCache-Control 标头和其值为 no-cache<的 Pragma 之间有什么区别?/代码>?

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天全站免登陆