etag中的W/出现在哪里? [英] Where does the W/ in an etag appear from?

查看:1060
本文介绍了etag中的W/出现在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对W/在未添加时在etag中的显示方式感到困惑. 我正在使用Node.js http服务器模块,并具有Nginx作为反向代理.我在浏览器中看到由Node.js服务器生成的Etag,但带有W/标签.

I am confused by how the W/ appears in the etag when I have not added it. I am using Node.js http server module and have a Nginx as reverse proxy. I am getting the browser see the Etag generated by the Node.js server but with a W/ tagged to it.

有人可以解释W/的来源吗?浏览器是否会根据其确定为弱标签来插入该标签?我希望浏览器在发送时得到它.没有W/前缀.

Can someone explain where that W/ comes from? Does the browser insert that based upon its determination that it is a weak etag? I want the browser to get it as I sent it. Without the W/ prefix.

这是浏览器中显示的Etag标头.

Here is the Etag header as seen in the browser.

etag: W/"asv1534746804282-d62serveav"

当尝试与if-none-match比较时,我必须剥离W/. 另外,对于304状态响应,我是否还需要发送Etag?

When trying to compare with if-none-match, I have to strip the W/. Also, with the 304 status response, do I again have to send the Etag?

编辑:我自己添加了W/,以便Nginx对其进行修改.我希望我的假设是正确的.好像是.

EDIT: I added the W/ myself so that Nginx leaves it unmodified. I hope my assumption is correct. It appears to be.

推荐答案

如果您要求nginx动态gzip您的内容,它将把您的ETag转换为弱标签.这是规范所必需的,因为强大的ETag仅可用于逐字节相同的内容.

If you ask nginx to dynamically gzip your content it will convert your ETags into weak ones. This is required by the specification, since a strong ETag can only be used for content that is byte-for-byte identical.

如果验证器同时由给定资源的两个或多个表示形式共享,则验证器将是弱的,除非这些表示形式具有相同的表示形式数据.例如,如果原始服务器为应用了gzip内容编码的表示形式发送相同的验证器,而不是为没有内容编码的表示形式发送相同的验证器,则该验证器是弱的.

A validator is weak if it is shared by two or more representations of a given resource at the same time, unless those representations have identical representation data. For example, if the origin server sends the same validator for a representation with a gzip content coding applied as it does for a representation with no content coding, then that validator is weak.

这篇关于etag中的W/出现在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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