是Vary:接受编码过大吗? [英] Is Vary: Accept-Encoding overkill?

查看:86
本文介绍了是Vary:接受编码过大吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读了 gzip压缩的工作方式后,我开始思考。如果原始服务器和代理服务器(CDN)都支持gzip,则添加 Vary:是否需要接受编码标头?

After reading about how gzip compression works it got me thinking. If the Origin and Proxy server (CDN) both support gzip is adding a Vary: Accept-Encoding header necessary?

推荐答案

Vary:Accept-Encoding 标头与缓存有关,而不是与压缩有关。当存在 Vary:Accept-Encoding 标头时,它告诉客户端可以缓存文件/客户端是否请求压缩都是相同的。

The Vary: Accept-Encoding header has more to do with caching than compression. When the Vary: Accept-Encoding header is present, it tells the client that the file can be cached/is the same whether or not the client requests compression.

如果由于某种原因,客户端在其缓存中具有文件的未压缩版本,它将不知道随后不再请求其压缩版本,而只是使用来自以下位置的未压缩文件

If for some reason the client has an uncompressed version of the file in its cache, it will know not to subsequently request a compressed version of it again and instead to just use the uncompressed file from the cache.

此处更多:什么会有所不同:接受编码是什么意思?

这篇关于是Vary:接受编码过大吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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